How to Install and Run 7-Zip on macOS

This guide provides a straightforward walkthrough on how to install and run 7-Zip on macOS. While 7-Zip is traditionally a Windows application, an official command-line version is available for macOS alongside third-party package managers. Below, you will find the quickest installation methods using Homebrew or the official standalone binary, followed by essential commands to compress and extract files.

The easiest way to install and maintain 7-Zip on a Mac is via Homebrew, the macOS package manager.

  1. Open the Terminal app from Applications > Utilities.
  2. If you do not have Homebrew installed, paste the following command and press Enter:
    /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
  3. Once Homebrew is ready, install the official 7-Zip package:
    brew install sevenzip
  4. Verify the installation:
    7z

Method 2: Manual Installation from the Official Binary

If you prefer not to use Homebrew, you can install the standalone macOS console version directly from 7-Zip.

  1. Go to the official 7-Zip download page and download the macOS console version (available for both x86-64 and ARM64 / Apple Silicon).
  2. Open Terminal and navigate to your Downloads directory:
    cd ~/Downloads
  3. Extract the downloaded .tar.xz file (replace the filename with your downloaded version):
    tar -xf 7z2301-mac.tar.xz
  4. Move the executable binary to your local bin directory to run it from anywhere:
    sudo mv 7zz /usr/local/bin/7z
  5. Grant execution permissions if prompted:
    sudo chmod +x /usr/local/bin/7z

How to Run 7-Zip on macOS

7-Zip runs through the macOS Terminal using simple command-line arguments.

1. Extract an Archive

To extract an archive while preserving its original directory structure, use the x command:

7z x filename.7z

To extract directly to a specific folder:

7z x filename.7z -o/path/to/destination/

2. Create a Compressed Archive

To compress files or folders into a .7z archive, use the a (add) command:

7z a archive_name.7z /path/to/folder_or_file

You can also specify other formats such as .zip:

7z a archive_name.zip file1.txt file2.txt

3. List Archive Contents

To view the contents of an archive without extracting it, use the l command:

7z l filename.7z

4. Create a Password-Protected Archive

To encrypt an archive with a password:

7z a secured.7z /path/to/folder -pYourPassword -mhe=on

The -mhe=on flag also encrypts the file names inside the archive.

Graphical Alternative for macOS

Because the official 7-Zip release on macOS operates exclusively in the command line, users who prefer a graphical interface (GUI) can install Keka, an open-source macOS file archiver powered by the 7-Zip core engine. Keka supports drag-and-drop compression and extraction for .7z and various other formats.