Unzip 7z Files on a Mac with p7zip
This post is brought to you by 30 minutes of frustration. I hope it saves you some time.
7z is a is not a native file type on mac. In order to open it, you will need to install a 3rd party application. I chose p7zip because I can manage it using homebrew.
Install p7zip
Install via homebrew:
brew install p7zip
Unzip a File
IMPORTANT: be in the SAME directory on your command line as the file you want to extract. If the file is on your desktop, be in the desktop on your command line. <— THIS is the thing that tripped me up.
# ex file location: /Users/yourusername/Desktop/compressed_file.7z
# cd into the correct location
cd ~/Desktop
# unzip the file
7z x compressed_file.7z
This will add a folder of unzipped files to that location, in this case, my Desktop.
Compress Files or Folder
To zip, use the a
argument followed by output filename and by the files/folder you want to compress. Again, ensure you’re in the same directory on the command line as your input file.
7z a compressed_file.7z folder_to_compress
You can see more compression options on the app manual page by running:
man 7z