Installing Cygwin Tutorial

, , …,

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/.

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

How to find out what Cygwin version am using??

in Cygwin terminal, 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

What's alternatives to Cygwin?

You can try MinGW, which is a lean version of Cygwin, mostly for building Unix software on Microsoft Windows, but doesn't have lots other unix utils.

I do not recommend MinGW, because often i need lots of unix utils, and they are not in MinGW. Cygwin has just about any unix command line software there are.

Another option is to use VirtualBox. You run entire Linux inside Windows. But it's slower. Guide to Install Linux on VirtualBox for Programers and Sys Admins

Cygwin Base Installation

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.

Installing Packages You Want

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.

Here's a list of unix tools you might want to install: Cygwin Essential Install List.

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 hard drive. If it means the file on my hard drive 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.

Cygwin Setup dialogue
The Select Packages dialog in Cygwin installer.

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 the choices of {Keep, ‹version number›, Reinstall, Source, Uninstall}, 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.

Misc

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.

Some Notes About Using Cygwin

Some random notes to myself about using Cygwin.

PATH environment variable

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/

Cygwin Path Issues

See: Cygwin Path Conversion.

See also:

blog comments powered by Disqus