Skip to content

Instantly share code, notes, and snippets.

@fscm
Created April 29, 2025 16:55
Show Gist options
  • Save fscm/153ab5e85455423e33613ff96f7c25a1 to your computer and use it in GitHub Desktop.
Save fscm/153ab5e85455423e33613ff96f7c25a1 to your computer and use it in GitHub Desktop.
[macOS] Install unrar tool from source

[macOS] Install unrar tool from source

Instructions on how to install the unrar command on macOS from source.

Prerequisites

macOS Command Line Tools need to be installed on your local computer.

To install the Command Line Tools run the following command:

xcode-select --install

Get the source

To obtain the GNU Tar tool source code run the following commands:

mkdir -p ~/.src/unrar
curl --silent --location --retry 3 "https://www.rarlab.com/rar/unrarsrc-7.1.6.tar.gz" | tar xz --no-same-owner --strip-components=1 -C ~/.src/unrar
cd ~/.src/unrar

Configure

No configuration required.

Build

To build the source code run the following command:

make --silent --no-print-directory -f makefile unrar

Install

To install the tool run the following commands:

sudo install -v -m 0755 unrar /usr/local/bin

Verify

Run the following command on a terminal window:

unrar

Libraries

First clean the previous build objects using the following command:

rm -f *.o

To build the libraries run the following command:

make --silent --no-print-directory -f makefile lib

To install the libraries run the following command:

mv libunrar.so libunrar.dylib
sudo install -v libunrar.* /usr/local/lib

Clean up

After installing the tool you can remove the downloaded source code using the following commands:

cd ~
rm -rf ~/.src
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment