How to Install Cygwin 1.5

Cygwin (http://www.cygwin.com/) is software that allows us to bring Unix flavor to Windows.

This is a step-by-step tutorial on how to install Cygwin along with gcc and make. Provided that the number of packages to install is close to described below, it will be necessary to download about 35 Mb of files from Internet. The space on disk taken by Cygwin after the installation is about 130 Mb.

Getting Started

The setup program for Cygwin is at http://www.cygwin.com/. In your browser click “Install Cygwin now” and either open setup.exe or save it to some directory. My practice is to save it to Local Package directory (see below). setup.exe is a small file that initiates network setup. It is possible to run it again in order to install new packages or update installed ones.

During the installation process, it will be necessary to choose two directories: one for files to download and another for the Cygwin by itself. No files will be written to other directories. However, a few entries will be added to the registry.

Running setup.exe

After starting setup.exe, there appear a master to install Cygwin. The windows are described below.

1) Cygwin Net Release Setup Program:

Click Next.

2) Choose A Download Source:

Check that Install from Internet is selected and click Next.

3) Select Root Install Directory:

Type in the place where do you want to install Cygwin (for example k:\cygwin) and click Next.

4) Select Local Package Directory:

Type in the place where do you want to keep the installation files (for example k:\cygwinsrc) and click Next.

5) Select Your Internet Connection:

Choose what is appropriate for your place and click Next.

6) Choose A Download Site:

Select a ftp site that is closest to you and click Next.

7) Select Packages:

This is the most important step. Our goal is to add gcc and make as without them it will not be possible to compile the code. The most important is not to include all the possible packages as in this case the download will take forever. Also an important thing is not to select the installation from the source code but rather to use binary install (it is by default).

a) Make sure that Curr is selected and click on View to make it Partial (the word should be printed on the left from the View button). In this mode you will see what packages will be installed by default. You see that they will be installed as Bin and Src is not selected. This what we need. It is a good idea to leave the default packages as they are. Our next goal is to add a few more packages to this list.

b) Click on View to make it Category (again the word should be printed on the left from the View button).

c) Click on + before Devel to expand it.

d) Find gcc-c++ and click on Skip. Instead of Skip there should appear version (in time of writing 3.4.4-1) and a cross in Bin. Note that other dependent packages are selected automatically.

e) Find gcc-g77 and click on Skip. Instead of Skip there should appear version (in time of writing 3.4.4-1) and a cross in Bin.

f) Find make and clike on Skip. Instead of Skip there should appear version (in time of writing 3.80-1) and a cross in Bin.

g) Click on – before Devel to close the tree of the development packages.

That’s it. Well, optionally you can add more packages. Personally I like wget in Web and curl in Net that allow us to download files from the command line. I find useful to have zip and unzip from Archive. Finally, I use tcsh (not bash) and it can be found in Shells.

e) Again Click on View to make it Partial. Check that the chosen packages appear in the view. Once more, the main problem is not to ask for too much. I do not know how much space is it necessary to install al the packages but I would guess that this should be well above 1 Gb. No doubts, you do not need Src.

f) Click Next. The download takes some time. With DSL, I needed about 5 min.

8) Create Icons:

Personally, I like to check “Create icon on Desktop”. Well, make your choice and click Finish.

First Steps

Provided that “Create icon on Desktop” has been selected, there should be a Cygwin shortcut on the desktop. It is a link to cygwin.bat that is located directly in the cygwin folder. You can customize the font, window size and colors in the icon properties.

In any case, you can run cygwin.bat directly.

By default, Cygwin starts bash. Personally, I use tcsh but this does not matter. The minimum functionality that we will need is to have gcc and make. If you want to change shell, just edit cygwin.bat and change bash to tsch there.

Provided everything went well, the commands

$ gcc -v

and

$ make -v

should write information about the versions of gcc and make accordingly.

However, if the output is something like “gcc: Command not found”, this means that something went wrong and it is necessary to run setup.exe again and add gcc.

The Cygwin documentation is available at the Cygwin site at http://www.cygwin.com/ or at cygwin/usr/share/doc/cygwin-doc-1.4/. It makes sense to read it.

Each shell has its own customization files. It also makes sense to spend some time on it.

Name completion is a very convenient way to work from the command line. Press Tab to see how it is working. Do not forget to press Tab after you have typed in a few letter of a filename.

The Unix documentation system is man. Type in

$ man man

to learn about it. Press q to quit. You can type

$ man make

or

$ man gcc

to learn more about these commands. Again, press q to quit.

The GNU documentation system is info. You can leave it by pressing q anytime. Type in

$ info info

to learn about it.

$ info make

or

$ info gcc

will give you more information about gcc and make than manpages. Tab navigates you in the info window between different links. Enter is the selection of the link. Press q to quit.

Finally, you can change your home directory by editing a line in /etc/passwd for your account and shell by editing cygwin.bat.

Useful links

http://www.cygwin.com/ – Everything about Cygwin.

http://www.ee.surrey.ac.uk/Teaching/Unix/ -UNIX Tutorial for Beginners

http://www.google.com/ – Type in the name of the command you are interested in and press Search. A good way is to add word tutorial, say gcc tutorial, make tutorial, unix tutorial and so on.


Comments are closed.