Here is how to install a free command line UnRAR tool (a RAR file extractor) and the RAR tool on Mac OS X. It’s simple and did I mention it’s free?
There is an image at the end of this post showing the steps taken in Terminal. Also, if you have Homebrew installed, you can use this for the installation of UNRAR. See instructions further down the page.
Download latest RAR for OS X “RAR 5.2.1 for Mac OS X” (or a later version if there is one) from RARLab.
Assuming that file is downloaded to your ~/Downloads folder, double click it to extract the files. You should now see in your ~/Downloads folder a folder called ~/Downloads/rarosx-5.2.1 (the number will be different if you downloaded a newer version since I late updated this post). In that folder is a /rar folder. So the full path is ~/Downloads/rarosx-5.2.1/rar
If you downloaded it to some other location then your file path will be different. Whatever it is, make a note of it.
Open Terminal.app. Just type Terminal into Spotlight (Command-Space to quickly access Spotlight). In Terminal.app type or paste the following (again remember to change the version number if you have a later version):
For OS X up to 10.9.x (if using Yosemite, first follow instructions as indicated a little further down the page)
Now type or paste:
sudo install -c -o $USER unrar /usr/local/bin
Whilst you’re at it, you might as well install the RAR tool too. Use this command in Terminal:
sudo install -c -o $USER rar /usr/local/bin
For OS X 10.10.x (Yosemite)
In Apple OS X 10.10.x (i.e. Yosemite) there is no /usr/local/bin folder by default. So you will need to first create this folder.
sudo mkdir -p /usr/local/bin
Now following the above instructions “For OS X up to 10.9.x”
After you hit enter on that command Terminal will prompt you for your password. Type it in and hit enter.
To test the installation went okay simply type unrar into Terminal. You should see a lot information appear in terminal. This is simply the details on how to use unrar and it shows that unrar is install.
Now you can UnRAR rar archives from the Command Line in Terminal.
To do an extraction use the x switch as shown below.
unrar x /path/to/file.part01.rar
TIP: To save yourself typing out the full path to the RAR file, you can simply grab the file in Finder and drag it onto Terminal. Do that after you’ve typed in unrar x(space)
There you go. All done.
Here’s a screenshot of showing the steps taken in Terminal.app
Using Homebrew to install UNRAR
If you have Homebrew installed on your system, you can also use that to install UNRAR. Just use this command:
brew install unrar
Note, it only installs UNRAR. If you also need RAR then you’ll have to use the instructions I posted above.
Other neat things you can do with command-line RAR/UNRAR
– Extracting RAR archive files from the command-line
– Repair damaged RAR files on Mac OS from the command-line
– Testing RAR archive files for corruption in Mac OS X from the command-line
Excelent! thanks a lot for your effort an explanation!
hello, on my OS X v10.8.3, /usr/local/bin couldn’t be found.
So I replace with /usr/bin
Thank you for the tip, I was having that issue as well!
Hello, thanks for this tutorial,
I’m having a little problem here; after installing the unrar and typing my password (step 4), when I try to check number 5 I get an error:
-bash: unrar: command not found
What am I doing wrong? It didn’t returned errors while installing or typing my password.
nevermind, I figured it out:) changed $USER for the actual username and removed /usr/local.
Thankyou very much:)
change /usr/local/bin to /usr/bin, just remove /local
sudo install -c -o yourAccuntName unrar /usr/bin
sudo install -c -o yourAccuntName rar /usr/bin
When the TERMINAL ask me for the password. What do I have to write?
You need to type in the password for your user account. The same one you use to log in to OS X (if you don’t have OS X set to log you in automatically, that is). It’s the password you type in whenever OS X prompts you for a password, such as when installing new software, etc. Type it in carefully, as it won’t show you that anything is being typed in (as you likely noticed).
Jan 2022: There is absolutely NOTHING right with this gist anymore.
Thanks Neil. Obviously this is a post from 2013 for Mac OS X 10.10.x. So no, unless you are still using Yosemite, this post is likely not going to be of use to you.