I am new to cygwin, less than a week and I must say it is great. I’m not too familiar with linux either other than change dir, remove dir or file commands. But being able to run a Unix emulator such as cygwin is a great way to get familiarized with the unix environment.
That said, you are probably in the same shoes I found myself in a few minutes ago. During my install of cygwin, I installed 7zip. this is an archiving and compressed file extracting utility. A recent task of mine was to extract text files from compressed formats and perform a line count. Most of the files were .zip files until I came across some .rar files. I thought 7zip would handle them since it handles .rar files via the windows interface, but instead I received an error.
$ 7z e test.rar 7-Zip 9.04 beta Copyright (c) 1999-2009 Igor Pavlov 2009-05-30 p7zip Version 9.04 (locale=C,Utf16=off,HugeFiles=on,2 CPUs) Can't load '/usr/lib/p7zip/Codecs/.keep-p7zip' (Permission denied) Processing archive: test.rar Extracting test_out.txt Unsupported Method Sub items Errors: 1
The correct command to issue was unrar e test.rar. But without having that RAR utility for cygwin and cygwin not not offering it through their regular setup or additional installs you need to take the following steps to install RAR on cygwin.
- Click on setup.exe in your original cygwin folder. Usually it is c:\cygwin.
- Run through the setup as you did the first time until you come to the “Select Packages” screen.
- From the packages listed, select make and makedepend. These packages are listed under Devel (for development). Finish out the wizard (note – you will not lose anything you had previously installed).
- Go to http://www.rarlab.com/rar_add.htm and download the UNRar source files
- Save and extract the contents of the package under your home directory of your cygwin environment. (Once extracted, a folder named unrar will hold all the files)
- Start up your cygwin environment
- navigate to the unrar folder that contains all the source files for unrar. Then type make -f makefile.cygmin. This is the name of the file that will create an unrar.exe file in that same directory. Your cygwin console will inform you when it is complete. it usually takes a minute or two.
- Copy the resulting unrar.exe file to your c:\cygwin\bin\ directory (or wherever your root cygwin directory is).
- Now you are ready to uncompress your .rar file.
- To do this, navigate to the directory holding your .rar file.
- Type: unrar e name_of_rar_file.rar
That’s it. Once you use this, you will love it. The performance is great.
In response to the comments made below, I’ve attached a screenshot of the gcc components that I have installed that allow the users to create the unrar.exe file to be placed in your bin. Also here is a link to download my unrar.exe (compiled on my Windows 7 machine) file in case anyone wants to bypass the compiling step. I know I am trustworthy, but always virus scan anything you download from the web.