Open RAR and 7z files on Mac from Terminal

Updated November 16, 2026

In short

Install Homebrew, run brew install unar, then unar archive.rar to extract a RAR or 7z file into the current folder. For 7z, brew install sevenzip gives you 7-Zip’s own 7zz command.

Archive Utility, the extractor built into macOS, can’t open RAR files (and opens 7z only on recent macOS releases), and Terminal’s unzip only handles ZIP. The usual fix takes two minutes. Install Homebrew, then run brew install unar, and unar archive.rar extracts the archive into the current folder. For 7z, 7-Zip’s own command-line tool is one more line away: brew install sevenzip, then 7zz x archive.7z.

If you’d rather not use Terminal at all, openrar.app opens RAR and 7z in the browser, and Mac archive apps compared lists the apps.

Step 1: Install Homebrew

Homebrew is the most widely used package manager for macOS: it installs command-line tools with a single command. Check whether you already have it:

brew --version

If you see a version number, skip to step 2. If you see command not found: brew, open brew.sh, copy the install command shown on the page, paste it into Terminal and press Return. At the time of writing it is:

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

The installer asks for your Mac password (nothing appears as you type, which is normal) and installs Apple’s Command Line Tools if they’re missing, which can take a few minutes.

On Apple silicon Macs, read the end of the installer’s output. It prints a “Next steps” section with commands that add Homebrew to your shell. Run them, or brew will still be “not found” afterwards. Then open a new Terminal window.

Step 2: Open RAR (and 7z) with unar

unar comes from the same engine as The Unarchiver. It reads RAR (RAR4 and RAR5), 7z, ZIP, TAR and many other formats.

brew install unar

This installs two commands: lsar to list what’s in an archive, and unar to extract it.

List the contents first

lsar archive.rar

Add -l for a longer listing with sizes and dates. Listing is a good habit with archives from unknown sources: you see what you’re about to unpack.

Extract

cd ~/Downloads
unar archive.rar

unar extracts into the current folder. If the archive has several items at its top level, it creates a folder named after the archive, so your Downloads folder doesn’t get flooded. Useful options:

  • unar -o ~/Desktop archive.rar extracts to another folder.
  • unar -f archive.rar overwrites existing files without asking.
  • unar -D archive.rar never creates the enclosing folder.

File names with spaces

Terminal splits commands at spaces, so unar My Archive.rar fails. Either put the name in quotes, unar "My Archive.rar", or type unar (with a space) and drag the file from Finder into the Terminal window: Terminal pastes its full path, correctly escaped.

Password-protected archives

unar asks for the password when it needs one. You can also pass it with -p, but that leaves the password in your shell history, so letting it prompt is better. See how to open a password-protected RAR.

Split archives

Keep all the parts in one folder and run unar on the first one (archive.part1.rar, or archive.rar when the others are .r00, .r01…). It finds the rest itself. More in how to open split RAR files.

Alternative for 7z: 7-Zip’s 7zz

7-Zip’s author publishes a macOS build of the 7-Zip command-line tool, and Homebrew packages it as sevenzip:

brew install sevenzip

The command it installs is 7zz (not 7z, as older guides say). The essentials:

7zz l archive.7z          # list the contents
7zz x archive.7z          # extract, keeping folders
7zz x archive.7z -oOut    # extract into the folder Out
7zz x archive.7z.001      # extract a split 7z archive

Note that there’s no space between -o and the folder name. Use x, not e: e dumps every file into one folder and loses the folder structure.

7zz can also create archives, which unar can’t: 7zz a backup.7z MyFolder makes a 7z of a folder. Adding -p -mhe=on asks for a password and encrypts the file names. 7-Zip for Mac covers it in more detail.

Common errors and fixes

zsh: command not found: brew. Homebrew isn’t installed, or the “Next steps” commands from the installer weren’t run. Install it or run those commands, then open a new Terminal window.

zsh: command not found: unar (or 7zz). The tool isn’t installed yet: run brew install unar or brew install sevenzip. If it says it’s already installed, the same PATH problem as above is the likely cause.

No such file or directory. Terminal is looking in the wrong folder or the name is misspelled. Use cd to go to the folder that holds the archive, or drag the file into the window to paste its exact path.

macOS asks whether Terminal may access your Downloads, Desktop or Documents folder. That’s macOS privacy protection. Allow it if you want to extract files there.

Wrong password, or a CRC or checksum error. A checksum error usually means the archive is incomplete or damaged: download it again. See what to do with a corrupt RAR file.

Missing volume. One part of a split archive is missing or renamed. Make sure every part is in the same folder, with its original name.

When Terminal isn’t the best tool

Terminal is ideal for scripts, servers and batches of archives. For the occasional download, a window is quicker: openrar.app opens RAR and 7z in any browser without installing anything, password-protected and split archives included, and OpenRAR for Mac adds archives of several gigabytes and Finder integration, free for personal use.

Open your archive now.

OpenRAR opens RAR, 7z, ZIP and more in your browser, for free. Nothing to install, nothing uploaded.

Open RAR on Mac

Questions.

What is the difference between unar and 7zz?

unar only extracts, and reads many formats including RAR, 7z and ZIP. 7zz is 7-Zip’s own tool: it extracts and also creates archives, and is the natural choice for 7z.

Why do I get “zsh: command not found: brew”?

Either Homebrew isn’t installed, or it is but your shell doesn’t know where it is. On Apple silicon Macs, run the two “Next steps” commands the installer prints, then open a new Terminal window.

Where does unar put the extracted files?

In the folder you’re in when you run it. If the archive holds several items at the top level, unar creates a folder for them. Use -o followed by a folder to extract somewhere else.

Can unar open split RAR archives?

Yes. Put all the parts in the same folder and run unar on the first part, such as archive.part1.rar. It reads the other volumes automatically.

Is there a way to open RAR files without Terminal?

Yes. Drop the file on openrar.app in your browser, or install an app such as OpenRAR for Mac, The Unarchiver or Keka.