Howto command-line unrar on Mac OS X
September 2nd, 2007, filed under AppleDecompressing *.RAR on a Mac OS X can’t be done by default. Of course you could use UnRarX to do this job, though not my cup of tea. I like command-line utilities e.g. par2cmdline and unrar. This post will help you installing the freeware unrar command-line tool from Rarlab.
Installation
Download the full package containing both rar (shareware) and unrar (freeware) from the Rarlab website. I’ve chosen the RAR 3.70 for Mac OS X package (rarosx-3.7.0.1.tar.gz). Decompress the package (just double click on the .tar.gz file) and you will see a new folder, named rar, containing the necessary files.
Enter your terminal, which can be found in /Applications/Utilities.

Start up Terminal on your Mac, located in /Applications/Utilities
Go to the newly created rar folder with both rar and unrar. You can use the command cd to change directories.

Entering the rar folder in your terminal. See full image
Use the following command to install unrar:
~$: sudo install -c -o $USER unrar /bin
$USER is a default environment variable in the bash shell which contains your username.
Sudo requires you to enter your user password. It’s the same password you use when you log in to Mac OS X. To install rar you can use the same command:
~$: sudo install -c -o $USER rar /bin
Do a test-run to see if the installation went properly. In your terminal now enter from any location you want:
~$: unrar
When unrar is properly installed, usage information should appear explaining commands and switches you can use. To decompress a .RAR package simply use the following command which will extract all files with full path:
~$: unrar x compressed-package.rar
In your terminal it will look like this:

Example of an extracted .RAR archive within your terminal. See full image
That’s it! Have fun decompressing .RAR archives on your Mac using cool command lines.
66 Responses
Have your say
You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>
You must be logged in to post a comment.