Apple - How can I unpack .7z files via MacOS terminal?

You can install p7zip with Homebrew. So

% brew install p7zip
% 7za x myfiles.7z

Installing Homebrew as @EraserPencil suggested makes sense as the OP might need more programs in the future, which would be at his fingertips then. You can install Homebrew with

/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

It should be noted there is 7z e as well but as commented by @Qback, this does almost never do what you want if you have subdirectories in the archive.


The command line version of Unarchive can extract .7z files.


MacOS does not handle the .7z format natively.

The UnArchiver is my favourite tool for handling .7z and many other formats. It is available as both an application and a command line tool if that is how you prefer to operate.