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 MacOS: Mojave, High Sierra, Sierra, Mavericks, Yosemite and El Capitan,….
I, Download and Install latest RAR for MacOS
Step 1: Download free RAR 5.7.0 from [http://www.rarlab.com/download.htm]
RAR 5.7.0 is currently the latest version at the time I wrote this article, so you should download latest one if available.
Step 2: Unzip the rarosx-5.7.0.tar.gz, and Copy and replace the following files (default.sfx, rar, rarfiles.lst, unrar) into “/usr/local/bin”.
How to locate “/usr/local/bin”?
From menu Finder, Go -> Go to Folder -> “/usr/local/bin”.
rar and 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.
Notification: If the unrar command line does not work, you can install unrar thourgh HomeBrew by the following command line:
brew install unrar