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

Looking to unpack a bunch of files.7z via terminal.

Is there a command-line tool built in, available or I shall install an application that comes with a graphical interface?


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.