Handle RAR and UNRAR through Command lines (Terminal) in Mac OS X without archiver softwares


Mac OS X does not support file.rar by default. Normally, to extract a file.rar or compress a file into File.Rar, mac users need to use an archiver softwares which costs money for the license.

Look at our very specific tutorial today to handle RAR and UNRAR through single and absolutely FREE command lines using terminal in Mac OS X - Mavericks, Yosemite and El Capitan.

I, Download and Install RAR 5.2.1 for Mac OS X through Terminal

Step 1: Download free RAR 5.2.1 from [http://www.rarlab.com/download.htm][1]
RAR 5.2.1 is currently the latest version at the time I wrote this article, so you should download latest one if available.
Step 2: After downloading, you should find the rarosx-5.2.1.tar.gz in Download folder. Double click on this file, we get the rar folder. So now we have this the /Downloads/rar direction. This direction can be different on yours.

Step 3: Launch Terminal (Found in /Applications/Utilities/), paste the following command line, then hit Enter key.

cd ~/Downloads/rar

Step 4: This step will be different on different OS X Versions and you need to provide your user account password if asked.

+, If you are using OS X 10.9.x or older (Lion, Mavericks), use the following command lines.

sudo install -c -o $USER unrar /usr/local/bin


sudo install -c -o $USER rar /usr/local/bin

+, If you are using Mac OS X 10.10.x and 10.11.x (Yosemite & El Capitan), enter the following command lines step by step.

sudo mkdir -p /usr/local/bin


sudo install -c -o $USER unrar /usr/local/bin


sudo install -c -o $USER rar /usr/local/bin

unrar command line is now available.

II, How to UnRar using Command Line in Terminal?
Using the following command line form, you can Unrar any files.rar in your Mac OS X without using any archiver softwares.

unrar x /path/to/filename.rar -d /patch/to/folder

/path/to/ is the direction of the targeted file.rar. and the folder you want to extract the file into.

For example, I have test.rar under this direction: unrar x /users/phanhongquan/desktop/appledigg/test.rar

I am able to unrar the file by the following command line.

unrar x /users/phanhongquan/desktop/appledigg/test.rar -d /users/phanhongquan/desktop/appledigg/

Otherwise, you can type "unrar x " (including a space), then drag and drop the targeted file.rar into terminal window.

The file.rar will be extracted into /users/your user name/ by default.

[1]: http://www.rarlab.com/download.htm

Read and Write NTFS in OS X El Capitan by installing ntfs-3g through Terminal


This is awesome. Thank for your share :ribbon:




when i make sudo mkdir -p /usr/local/bin (because i have OS el capitan) i recieve a message not a directory



I followed the instructions to get winrar to work on a mac using the terminal. I was able to get both the rar and unrar command lines to work, but at some point when I try to use unrar I get the following:

Would you like to replace the existing file /Users/Bart/Documents/.DS_Store
18436 bytes, modified on 2016-06-28 01:02
with a new one
18436 bytes, modified on 2016-06-28 01:00

[Y]es, [N]o, [A]ll, n[E]ver, [R]ename, [Q]uit e

The .DS_Store is not part of the file extension that I want to unzip, and whatever I select in terms of options the .rar file is not unzipped. It also asks me to replace some other files, most of which come from the rar folder that I downloaded from WinRAR. Any help with this would be appreciated.