Installing and Uninstalling the Cygwin Unix Emulator

This document shows you how to install and uninstall the Cygwin Unix Emulator for Microsoft Windows. It is essential to install this environment if you want to run the GNU Tools under Windows instead of under Linux (their native environment).

If you encounter any problems with these instructions, you should at least read through the [PDF] Cygwin User’s Guide on this CD-ROM before consulting your lecturer or other competent help.

Please note that the Cygwin Unix Emulator does not provide all of the applications that are available in a typical Linux installation: only the most essential programs are included. In particular, your choice of a decent text editor is severely limited: either you need to use vi (shudder!) or you need to install a third-party text editor like TextPad. You cannot use the default Windows Notepad text editor.

In this document, something like “Start » Settings » Control Panel” means that you click on the Start button, select the Settings sub-menu and finally click on Control Panel. “$” will indicate the Cygwin shell prompt. Anything in a bold monospaced font is what you are expected to type in; an ordinary monospaced font is used for the computer’s response. Please note that this document doesn’t always show every response from the computer!

It is an unfortunate fact of life that every major version of Microsoft Windows behaves differently. This means that you may need to adjust these instructions to suit your version of Windows. These instructions have been verified for Windows 2000 Professional, Windows NT 4 and Windows 98SE only.

Minimum System Requirements

In order to successfully install and run the Cygwin Unix environment, you will need to meet at least the following requirements:

1. Microsoft Windows NT 4 or later (including Windows 2000, Windows XP Home and Windows XP Professional), or Windows 98SE, as your operating system,
You almost certainly know the operating system that you are running… If not, select Start » Settings » Control Panel, then double-click on the System icon. (Of course, this is different under Windows XP: you need to select Start » Control Panel, then select Classic View from the View menu, before double-clicking on the System icon…)
As a rule, Linux is the recommended platform for the GNU Tools and for all serious programming in general. If you insist on using Microsoft Windows, then Windows 2000, Windows XP Home or Windows XP Professional are the better options. Windows 98SE (Second Edition) is not really recommended for serious work due to its many problems (also known as bugs!). You should positively avoid Windows 95, Windows 98 and Windows ME (Millennium Edition).
2. At least 250 MB of free disk space for Cygwin (as well as an additional 125 MB for the GNU Tools — a total of at least 375 MB),
You can find out how much disk space you have free on your C: drive by opening the Windows Explorer (Start » Programs » Accessories » Windows Explorer, or Start » Programs » Windows Explorer, depending on your version of Windows), right-clicking on the C: drive under “My Computer”, then selecting Properties. Use the figure under “Free Space” only as a guide.
3. If you are running Microsoft Windows NT, Windows 2000 or Windows XP Professional, the password for the Administrator account on your system.

Installation Instructions

Installing the Cygwin Unix environment can be a little tricky, so take care to follow these instructions exactly. It might help you to print out and read through these instructions before proceeding… maybe it’s easier to run Linux!

1. If you are running Microsoft Windows NT, Windows 2000 or Windows XP Professional, log in as Administrator. If you are running Microsoft Windows XP Home or Windows 98SE, simply log in.
2. Run the Cygwin setup.exe program in the [List] gnutools/cygwin/win32 directory on this CD-ROM. A window will appear with an introduction.
3. Click Next to skip the introduction, select “Install from Local Directory”, then click Next. The window will now show installation options.
4. Make sure that the Root Directory is “C:\cygwin”, that “All Users” is selected in the group “Install For”, and that “Unix” is selected in the group “Default Text File Type”. Click Next. The window will change to show the package installation directory.
5. Make sure the Local Package Directory is set to “D:\gnutools\cygwin\win32” (you may need to replace “D:” with the drive letter of your CD-ROM). Click Next. After a short delay, a listing of packages will appear in the installation window.
6. Click on the (rather small) View button in the top right-hand corner until the word “Full” appears next to it. This will display a full listing of all packages. By the way, don’t try to “cheat” by selecting “Categories” — it does not work properly!
7. Carefully work through the list of packages, one by one, clicking on the circular arrows (in the New column) so that no package shows “Skip” (in other words, so that every package shows a version number next to it).
8. Check this list of packages again very carefully, then click Next. Cygwin will now be installed.
9. Once the packages are installed, make sure that “Add Icon to Start Menu”, at least, is selected. Click Finish.
10. You now need to add C:\cygwin\bin to your path. This procedure is, unfortunately, different for every major version of Microsoft Windows…
For Windows NT 4: Start the Control Panel (Start » Settings » Control Panel), then double-click on the System icon. Now choose the Environment tab. Select the Path variable (in the System Variables section) by clicking on it. In the Value edit box, add C:\cygwin\bin; to the front of the variable definition — do not overwrite what is already there! Note the semicolon “;”: this separates path segments. Click the Set button, then OK. You can now close the Control Panel window and proceed to step 11.
For Windows 2000: Start the Control Panel (Start » Settings » Control Panel), then double-click on the System icon. Select the Advanced tab and click on Environment Variables. Select the PATH variable (in the System Variables section), then click Edit. Add C:\cygwin\bin; to the front of the variable definition — do not overwrite what is already there! Note the semicolon “;”: this separates path segments. Click OK, OK and OK until you are back at the Control Panel. You can now close the Control Panel window and proceed to step 11.
For Windows XP Home or Professional: Start the Control Panel (Start » Control Panel), select View » Classic View, then click on the System icon. Select the Advanced tab and click on Environment Variables. Select the PATH variable (in the System Variables section), then click Edit. Add C:\cygwin\bin; to the front of the variable definition — do not overwrite what is already there! Note the semicolon “;”: this separates path segments. Click OK, OK and OK until you are back at the Control Panel. You can now close the Control Panel window. If you are running Windows XP Home, proceed to step 13. If you are running Windows XP Professional, proceed to step 11 instead.
For Windows 98SE: Start the Run dialog box (Start » Run, or the WIN+R key-press) and enter notepad c:\autoexec.bat. Click OK. When the editor window appears, add the following line to the end of the file:
set PATH=C:\cygwin\bin;%PATH%
Save the file (File » Save) and quit the editor (File » Exit). Now, restart your system (Start » Shutdown, then select Restart). Once the computer has restarted and you are logged back in, proceed to step 13.
11. (For Windows NT, Windows 2000 and Windows XP Professional only). You need to create the directory C:\cygwin\home and give all users full control over it. The procedure to do so is different under every version of Windows. In addition, depending on precisely how your version of Windows is set up, your users may already have full control over this to-be-created directory.
For Windows NT 4: Open a Windows Explorer window (Start » Programs » Windows Explorer, or the WIN+E key-press). Create the directory C:\cygwin\home (File » New » Folder) and give all users full control over it. This is done by right-clicking the newly-created directory, selecting Properties, then the Security tab. Click Permissions, select the user “Everyone”, change the type of access to Full Control, then click OK. Now click OK to close the original dialog box.
For Windows 2000: Open a Windows Explorer window (Start » Programs » Accessories » Windows Explorer, or the WIN+E key-press). Create the directory C:\cygwin\home (File » New » Folder) and give all users full control over it. This is done by right-clicking the newly-created directory, selecting Properties, then the Security tab. Click Add, select the user “Everyone”, then click OK. Highlight that user (in the original dialog box) and make sure all checkboxes are selected. Click OK to close the dialog box.
For Windows XP Professional: [This version of the installation instructions has not been tested on Windows XP Professional. If you have successfully installed Cygwin under this version of Microsoft Windows, you might like to contact John Zaitseff by e-mail at with the exact steps that you took to do so.]
If you are a security-conscious system administrator, you will rightly balk when reading the above instructions. In such a case, simply create C:\cygwin\home\username for every user on your system and give each user full control over his or her directory only.
12. If you are running Windows NT, Windows 2000 or Windows XP Professional, give Everyone full control over the C:\cygwin\tmp, C:\cygwin\var\tmp and C:\cygwin\usr\tmp directories. Step 11 has all the necessary instructions…
13. Open a Cygwin window for the first time (Start » Programs » Cygwin » Cygwin Bash Shell).
14. Enter the following two commands:
mkpasswd -l -g > /etc/passwd
mkgroup -l > /etc/group
(Please note that both command lines use a lower-case “L” for the option (“-l”), not the number “1“
15. View the generated file /etc/passwd:
more /etc/passwd
Under Windows 98SE, this file should look something along the lines of:
John::500:544::/home/John:/bin/bash
Under Windows NT 4, Windows 2000, Windows XP Home and Windows XP Professional, this file should look something similar to:
Everyone:*:0:0:,S-1-1-0::
SYSTEM:*:18:18:,S-1-5-18::
Administrators:*:544:544:,S-1-5-32-544::
Backup Operators:*:551:551:,S-1-5-32-551::
Guests:*:546:546:,S-1-5-32-546::
Power Users:*:547:547:,S-1-5-32-547::
Replicator:*:552:552:,S-1-5-32-552::
Users:*:545:545:,S-1-5-32-545::
Administrator:unused_by_nt/2000/xp:500:513:Local System Administrator,U-ALTAIR-01\Administrator,S-1-5-21-57989841-1957994488-839522115-500:/home/Administrator:/bin/bash
Guest:unused_by_nt/2000/xp:501:513:Guest Account,U-ALTAIR-01\Guest,S-1-5-21-57989841-1957994488-839522115-501:/home/Guest:/bin/bash
John:unused_by_nt/2000/xp:1001:513:John Zaitseff,U-ALTAIR-01\John,S-1-5-21-57989841-1957994488-839522115-1001:/home/John:/bin/bash
Observe, in particular, that this file is a sequence of lines (which might be “wrapped around” on the Cygwin shell command line if they are too long), where each line is separated into fields by “:”, colons. Now, check that the second-last field in each line (the home directory field) is /home/username for each real user on your system. If it is, simply jump ahead to step 17 — this is the default on most installations. However, if it is not, proceed to step 16.
16. You have an unusual installation of Microsoft Windows that requires you to have some Unix expertise… Use the VI editor vi to edit /etc/passwd, replacing the second-last field for each real user with /home/username as appropriate. The exact details of how to do this are beyond the scope of this document; you may need to consult expert help.
17. Copy the textpad script from this CD-ROM, so that you will be able to use the TextPad text editor under Cygwin:
cd /cygdrive/d/unsw/common/labsetup-win32/other
cp textpad /usr/local/bin
chmod u+w /usr/local/bin/textpad
These commands assume that your CD-ROM appears as drive D: on your system. If it is not, replace the “d” in the first line with the drive letter of your CD-ROM. See the instructions for mounting the CD-ROM for more details.
18. Log out (or restart your computer), then log back in. If you are running Windows NT, Windows 2000 or Windows XP Professional, log in as an ordinary user.
19. Open a Cygwin window (Start » Programs » Cygwin » Cygwin Bash Shell).
20. Check that everything is working by typing pwd into this window. You should see something like /home/username, where username is the name you used to log in. Type exit to close the window.
If something other than /home/username appeared in the previous step, please review /etc/passwd by going back to step 15. If necessary, consult expert help!
21. You have successfully, at long last, installed the Cygwin Unix Emulator! You may now install the TextPad editor, then install the GNU Tools for Microsoft Windows.

Uninstallation Instructions

You will be relieved to know that uninstalling the Cygwin Unix Emulator is much easier than installing it! Simply follow these steps:

1. If you are running Microsoft Windows NT, Windows 2000 or Windows XP Professional, log in as Administrator. If you are running Microsoft Windows XP Home or Windows 98SE, simply log in.
2. Open a Windows Explorer window (Start » Programs » Accessories » Windows Explorer, or Start » Programs » Windows Explorer, depending on your version of Windows).
3. Find the C:\cygwin directory and select it with the left mouse button.
4. Press Shift+Delete (ie, the Shift and Delete keys together) to delete the directory without sending it to the Recycle Bin. You will be asked to confirm this; do so by clicking Yes.
5. You can now delete the icons in the Start menu and on the desktop.
6. You have successfully uninstalled the Cygwin Unix Emulator.