This page is a short guide on installing Cygwin on Windows (Vista), based on my personal experience, and some commentary.
Here's Wikipedia article Cygwin for general info, and here's the homepage: http://www.cygwin.com/.
First, download the cygwin installer “setup.exe”.
Run it. Accept the default parameters, unless you really have a need to change things.
When in the dialog to choose what programs to install, simply accept the default. Once you done installation of the base packages, you can come back to it and install other packages you need. If this is your first time, i highly recommend you follow this.
The above should be smooth. When finished, you can test run cygwin by clicking the icon on desktop, and the cygwin terminal should come up. That means bash is running, and you've installed cygwin successfully.
Now, find out what other programs you need. For example, cygwin does not install ssh by default. Let's say you want to install ssh.
Run “setup.exe” again. Accept the same defaults, in particular, try to stick with the mirror site you used before.
The installer may give you a warning: “This setup.ini is older than the one you used last time you installed cygwin. Proceed anyway?”. When this happens, be very careful. I accepted it a few times that resulted in reinstalling lots of packages, and that often screwed up things that i ends up deleting the whole cygwin dir and reinstall everything. (The warning is very ambiguous. It is not clear which setup.ini it is talking about. If it means the one from the mirror site, then of course it will be older than the one on my harddrive. If it means the file on my harddrive is older than the one on mirror site, then, it is not clear why should i care. It does not point out what setup.ini is doing or how it is used, or if installer is relying on the one on my drive or the mirror site, or if the installer is going to do a copy from the mirror site to my disk then use the one on my disk. I can't see how useful this warning is.)
Here's what to do when the Select Packages dialog comes up.
The Select Packages dialog has a very confusing interface. To understand it, first, understand about the check boxes (shown as “n/a” by default). For each program, there are 2 check boxes. One is for installing binary, the other is source. When a check is marked, that means you are telling cygwin to install that package. To toggle the checkbox, you have to click on that circular arrow icon to the left of the “Skip” or “Keep” word. (i'll call it the “cycle” icon)
Here's how the cycle icon works. Click it does several things, and what it does depends on whether you already have that package installed.
For packages you have already installed, it shows “Keep” by default. Clicking on it cycles you thru “Keep”, “‹version number›”, “Reinstall”, “Source”, “Uninstall” options, and will toggle the checkboxes if apropriate.
For packages you have not yet installed, it shows “Skip” by default. Clicking on it cycles you thru “Skip”, then older version, then other older versions if available, then back to “Skip”, and each click update the checkboxes as appropriate.
It does not hurt to click the cycle icon, but you have to be careful, because if you click without paying good attention, you may get yourself installing older version, or uninstalling your software. If you made too many clicks and you forgot what is the original, you can click on Cancel button to exit the installer and restart again.
There are also some view options at the top. The interface is badly designed in that it is very confusing. I recommend not to use it unless you know Cygwin well. If you did click it just for curiosity, you can exit the installer then restart again.
(WARNING: When you run the “setup.exe”, best to quit any cygwin processes you might have running, because that might interfere with install when the installer wants to access the same files or dll. Also, be sure you didn't by mistake have the checkbox on for all your installed packages. If you do, it'll reinstall all your packages, which may run into problems if you have ran cygwin in your Windows session. Because, for example, the installer may tell you: “Unable to extract /usr/bin/cygiconv-2.dll -- the file is in use.”. The dll is a library, so you can't really quit it. When this happens, cancel the installation. Then, start setup again.)
This installer name “setup.exe” is very stupid. It is a generic name, doesn't indicate what program it is a setup for. They should at least put cygwin into the name, so it is easy to identify.
Also note, the installer first download the packages, then install them. The downloaded packages are all kept in a dir that you specified in the installer. You can view these with Explorer.
For example, on my machine the path is:
C:\Users\xah\Downloads\http%3a%2f%2fwww.goh4.com%2fcygwin%2f. (note the unreadable percent symbols there.)
You should not delete this folder, because when you install things again, it may need some packages you've already installed, saving you the time to download them all again.
To uninstall cygwin, you can simply delete the whole cygwin dir. On my machine, it's
C:/cygwin/. (make sure you quit all cygwin processes first)
Some random notes to myself about using cygwin.
It is important to set the $PATH Environment variable correctly.
In cygwin terminal, my $PATH env var by default is:
/usr/local/bin /usr/bin /bin /usr/X11R6/bin /cygdrive/c/Windows/system32 /cygdrive/c/Windows /cygdrive/c/Windows/System32/Wbem
By default it also has these:
/cygdrive/c/hp/bin/Python /cygdrive/c/Program Files (x86)/ATI Technologies/ATI.ACE/Core-Static /cygdrive/c/Program Files (x86)/QuickTime/QTSystem/
that comes after the Wbem. I'm sure they are no good.
The filename path issue between unix and Windows can be complex.
Read: Path (computing) and http://cygwin.com/cygwin-ug-net/using.html#using-pathnames.
In general, i think, when you are in cygwin, always use path of this style: 〔/something/something〕. When you need for example 〔C:/Users/mary/notes.txt〕, use 〔/cygdrive/c/Users/mary/notes.txt〕.
For example, when i started to use cygwin, had a problem that caused me few hours. I have a python program that makes a system call of imagemagick's “convert” command. This all works fine in OS X. When trying to run it on Windows with cygwin, i simply changed the input paths from 〔/Users/xah/web/〕 to 〔C:/Users/xah/web/〕. This does not work. After some hours of looking, here's some detail:
When in cygwin terminal, the following does not work:
# cygwin complains cannot find the second file # convert: unable to open image `/Users/xah/x2.jpg': No such file or directory. convert C:/Users/xah/x.png C:/Users/xah/x2.jpg convert "C:/Users/xah/x.png" "C:/Users/xah/x2.jpg" # complains cannot find the first file convert /Users/xah/x.png ~/x2.jpg convert "C:/Users/xah/x.png" /Users/xah/x2.jpg convert /Users/xah/x.png /Users/xah/x2.jpg convert /Users/xah/x.png x2.jpg
The following creates the image, but the result image is bad.
# creates image, but bad img data convert C:/Users/xah/x.png "C:\Users\xah\x2.jpg" convert C:/Users/xah/x.png C:\\Users\\xah\\x2.jpg # this one creates image in the in current dir as Usersxahx2.jpg convert C:/Users/xah/x.png C:\Users\xah\x2.jpg
The following works:
convert "C:/Users/xah/x.png" ~/x2.jpg convert C:/Users/xah/x.png ~/x2.jpg convert C:/Users/xah/x.png /cygdrive/c/Users/xah/x2.jpg convert /cygdrive/c/Users/xah/x.png /cygdrive/c/Users/xah/x2.jpg
Here's some lesson learned:
How to find out what Cygwin version am using??
in bash, type “uname -a”. Example
$ uname -a CYGWIN_NT-6.0-WOW64 xah-PC 1.5.25(0.156/4/2) 2008-06-12 19:34 i686 Cygwin
See also: Cygwin: What's Installed by Default and Which Unix Tool to Install ◇ Unix tools on Windows: Cygwin vs VirtualBox.