Mac Os Unrar Command Line

This guide describes the use of the WinRAR command-line tools (v5.01) for compressing and uncompressing files in a directory and their use in batch files (for IZArc and 7-zip, see this post). This guide is an extension of a previous post, Automate Zipping Tasks using the Command-line Interface that explained the use of the command-line tools for two free compression utilities, IZArc and 7-Zip. The information in this guide was tested on a Windows PC running Vista.

Apr 09, 2015 To use the RAR command-line application, place the files in any folder on your hard drive, and call the utility by typing in the full path to the application (e.g., to run from the current directory, type “./rar” or “./unrar” followed by the appropriate parameters). In command-line you normally use mount and umount commands.nix. In OS X, you can use diskutil for getting info on your disk, as well as other things. To mount MSDOS drives (what most thumb drives. WinRar is also available for OS X, and he has the OS X version. However, WinRar on the Mac is available for the command line only- there's no GUI interface. What he has are the actual program files that you have to call in the command line to use them. For example, in order to rar up a file, use the 'rar' file. To unrar, use the 'unrar' one. UnRAR for Mac OS X 64 bit: Command line freeware 64 bit Mac OS X UnRAR. UnRAR for PowerPC Mac OS X; Sep 27, 2015 WinRAR For Mac Download. If you download WinRAR for Mac you will get: Simpler ways of operation, easier user interface, efficient file compressing, and command line based interface for more advanced users, creation of self. The command line version RAR for MAC OS X is only available in 32bit, because at time we have only a few requests for a command line 64 bit version. We use the source of RAR.exe to compile command line versions for all operation systems.

WinRAR is a popular and powerful archive manager that can be used from the command-line or with scripting languages such as batch files. It includes two command-line tools, rar.exe and unrar.exe, where rar.exe compresses and unrar.exe uncompresses files. Both are located in the “C:Program FilesWinRAR” folder in the installable version. Although WinRAR is shareware, it can be used on a trial basis for 40 days. Using WinRAR’s command-line tools is similar to those for IZArc and 7-Zip. The syntax for using the WinRAR executables is:

To get a listing of the options for the rar and unrar commands, open a command window, cd to the WinRAR directory, and type rar or unrar and then press enter (rar /? or rar help may also be used, use rar >rar_cmds.txt or unrar >unrar_cmds.txt to print the command options to a file). For more detailed information, open the rar.txt file in the WinRAR directory which contains the RAR console version user’s manual.

Examples to compress a folder:

creates archive yourfiles.rar and compresses all .txt files in the current folder

creates archive yourfiles.rar in C:yourfolder and compresses all .txt files in the current folder and its subfolders

creates archive yourfiles.rar in C:yourfolder and compresses all .txt files in otherfolder and its subfolders

creates archive yourfiles.rar and compresses all files in the current folder, but doesn’t include subfolders (note lack of extension; WinRAR will use the default extension .rar)

“a” command. Adds to the archive

“-r” switch. Recurses subfolders

Examples to uncompress a folder:

extracts all *.gif files from yourfile.rar to c:extractfolder (trailing backslash required) and restores the folder structure

extracts all files in c:yourfile.rar to the current folder (folder structure ignored)

“x” command. Extracts with full paths

“e” command. Extracts and ignores paths

Compression example using Multiple Switches:

compresses all new or updated files from c:test and its subfolders to e_archive.rar, deletes the files after they are added to the archive, and excludes any files with a “bat” extension,

“a” command adds to the archive

“-r” switch. Recurses subfolders

“-ep” switch. Adds files to the archive without including the path information. Multiple can exist in the archive with the same name.

“-u” switch. Equivalent to the “u” command when combined with the “a” command. Adds new files and updates older versions of the files already in the archive

“-df” switch. Deletes files after they are moved to the archive

“-x” switch. Excludes the specified file(s) from the operation

Basic rules for WinRAR:

  • When files or listfiles are not specified, all files in the current folder are processed
  • When specifying all files in a folder, yourfolder or yourfolder*.* are equivalent
  • Folder structures are automatically saved in archives (but not automatically extracted)
  • WinRAR uses the .rar extension by default, but that can be overridden by specifying the zip extension in the archive name
  • Switches and commands are not case sensitive and can be written in either upper or lower case

Another point is that WinRAR doesn’t appear to install to the Windows path environment variable, so it must be specified either at a command prompt, set permanently in the environment variable settings, or specified in a batch file (WinRAR v3.71.0.0 was used for this guide and that may not be the case for all versions).

To set the Windows path environment variable temporarily at a command prompt or in a batch file, use the following command:

To set it permanently in the Windows path for your PC:

start–>Control Panel–>System–>Advanced system settings–>Advanced Tab–>Environment Variables–>System Variables–>Path–>Edit. Add the path ;C:Program FilesWinRAR; to the end (don’t forget the single semicolons at the beginning and end). Hit OK three times.

Using WinRAR in Batch Files:

Two batch file examples are provided below, The uncompress_rar.bat file decompresses all .rar files from a folder and places the extracted files into another directory.

The compress_rar_rev2.bat file provides the following compression options for a user specified directory. Option 4 is the most commonly used structure and the most appropriate option in most cases:

  1. Compress files in dir individually (no subdirs)
  2. Compress files in dir and subdirs individually – no paths
  3. Compress all files in dir into a single archive (no subdirs)
  4. Compress all files in dir and subdirs into a single archive
  5. Compress all files in dir and subdirs into a single archive – no paths

Be sure to change the extension(s) to .bat before using either file and edit the folder paths as required. Both of the following batch files temporarily set the Windows path environment variable for the WinRAR application folder when executed.

Mac stopped reading external hard drive. Batch file downloads:

If you have found a spelling error, please, notify us by selecting that text and pressing Ctrl+Enter.

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.

Step 1

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.

Step 2

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):

Step 3

Mac Os Unrar Command Line

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:

Whilst you’re at it, you might as well install the RAR tool too. Use this command in Terminal:

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. Vengeance producer suite bundle torrent. So you will need to first create this folder.

Now following the above instructions “For OS X up to 10.9.x

Step 4

After you hit enter on that command Terminal will prompt you for your password. Type it in and hit enter.

Step 5

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.

Mac Os Unrar Command Line

To do an extraction use the x switch as shown below.

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

Unrar Os X

If you have Homebrew installed on your system, you can also use that to install UNRAR. Just use this command:

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

Mac Os Unrar Command Line Download

– Repair damaged RAR files on Mac OS from the command-line

Mac Os Unrar Command Line Linux

– Testing RAR archive files for corruption in Mac OS X from the command-line