How to Install unrar on macOS Using Homebrew

This guide provides a straightforward walkthrough on installing the unrar command-line utility on macOS using the Homebrew package manager. You will learn the necessary prerequisites, the exact terminal commands to run for installation, how to verify that the tool is installed correctly, and the primary commands used to extract RAR archives on your Mac.

Prerequisites

Before beginning, ensure you have the following:

  1. A Mac running macOS with access to the Terminal application.
  2. Homebrew installed on your system. If you do not have Homebrew, open Terminal and run /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)".

Step 1: Update Homebrew

Ensure your local Homebrew formulae are up to date by running:

brew update

Step 2: Install unrar

To install the unrar tool, enter the following command in Terminal:

brew install unrar

Homebrew will download the source files, compile them, and add the unrar binary to your system's PATH.

Step 3: Verify the Installation

To verify that unrar has been installed properly, check its version and command options by running:

unrar

If the installation was successful, the terminal will display the UNRAR version number along with a list of available commands and switches.

How to Use unrar

Once installed, you can extract RAR files directly from the command line:

  • Extract preserving directory structure:
    unrar x archive.rar
  • Extract all files into the current directory (ignoring folder paths):
    unrar e archive.rar
  • List the contents of an archive without extracting:
    unrar l archive.rar
  • Test the integrity of an archive:
    unrar t archive.rar