4.4. Windows: Cygwin

Cygwin provides a lot of UNIX based tools on the Windows platform. It uses a UNIX emulation layer which might be a bit slower compared to the native Windows tools, but at an acceptable level. The installation and update is pretty easy and done through a single utility, setup-x86.exe for 32-bit Windows and setup-x86_64.exe for 64-bit Windows.

The native Windows tools will typically be a bit faster but more complicated to install, as you would have to download the tools from different web sites and install and configure them individually.

[Note]You must have Cygwin installed

As there’s no Windows native bash version available, at least a basic installation of Cygwin is required in any case. This may change in the future as packaging systems such as NuGet and Chocolatey mature.

Although Cygwin consists of several separate packages, the installation and update is done through a single utility, setup-x86.exe or setup-x86_64.exe, which acts similarly to other web based installers. Alternatively you can install Cygwin and its packages using Chocolatey.

4.4.1. Installing Cygwin using the Cygwin installer

You will find setup-x86.exe, for 32-bit systems, and setup-x86_64.exe, for 64-bit systems, at http://www.cygwin.com/install.html. Click on the link for the appropriate setup utility to download it. After the download completes, run it.

All tools will be installed into one base folder. The default is C:\cygwin.

The setup utility will ask you for some settings. The defaults should usually work well, at least initially.

If, at the "Choose A Download Source" page, you use the default "Install from Internet" setting, you will need to choose a download site at the "Choose A Download Site" page. See the list of mirror sites at http://cygwin.com/mirrors.html to choose a download site appropriate to your location.

At the "Select Packages" page, you’ll need to select some additional packages, which are not installed by default. Navigate to the required Category/Package row and click on the "Skip" item in the "New" column so it shows a version number for the required package.

After clicking the Next button several times the setup will then download and install the selected packages (this may take a while, depending on the package size).

Under: Start→Programs→Cygwin→Cygwin Bash Shell you should now be able to start a new Cygwin bash shell, which is similar to the standard Windows command line interpreters (command.com / cmd.exe) but much more powerful.

4.4.2. Add/Update/Remove Cygwin Packages

If you want to add, update, or remove packages later you can do so by running the setup utility again. At the "Select Packages" page, the entry in the "New" column will control what is done (or not) with the package. If a new version of a package is available, the new version number will be displayed, so it will be automatically updated. You can change the current setting by simply clicking at it, it will change between:

  • A specific version number. This specific package version will be installed.
  • Skip. Not installed, no changes.
  • Keep. Already installed, no changes.
  • Uninstall. Uninstall this package.
  • Reinstall. Reinstall this package.

4.4.3. Installing Cygwin using Chocolatey

Chocolatey supports Cygwin as an external package source. To install Cygwin itself run

PS$>choco install cygwin
# You might also need to install cyg-get:
PS$>choco install cyg-get

Chocolatey installs Cygwin in C:\tools\cygwin by default.

One or more Cygwin packages can be installed using "cyg-get":

PS$>cyg-get sed asciidoc