Setting up Cygwin

What is Cygwin?

Cygwin is a "command-line interface" (i.e. a terminal, like the terminal on Linux or Terminal.app on Mac OS X) for Windows. You can run normal UNIX programs like "ls" and "cd", or even more sophisticated ones like "gcc". It also allows you to SSH into remote computers, which makes it a perfect alternative to PuTTY.

screenshot of cygwin
The default look of Cygwin.
using ssh on cygwin
SSH on my customized Cygwin.

Install Cygwin

Cygwin is available as a installable download at cygwin.com. Although the site offers both 32-bit and 64-bit versions, you should use the 32-bit version (setup-x86.exe), regardless of your computer's architecture, as not everything works in the 64-bit version.

Once you've downloaded setup-x86.exe, run the installer. The default options are all fine, so just click through all the prompts. Beware that the actual installation process may take up to an hour.

Install apt-cyg

You may have heard of programs like apt-get (Ubuntu), yum/dnf (Fedora), pacman (Arch), or brew (Mac OS X). These programs help manage the installation and upkeep of other command line programs on their respective operating system (for this reason, they are known as "package managers"). The analogous program for Cygwin is called apt-cyg.

Installing apt-cyg is simple. First, save this file: https://raw.githubusercontent.com/transcode-open/apt-cyg/master/apt-cyg . Then, use File Explorer to find the file in your Downloads folder and move it into C:\cygwin\bin. Then, open Cygwin and enter "chmod +x /bin/apt-cyg". This tells Cygwin that you want to be able to execute the apt-cyg command. Lastly, enter "apt-cyg mirror ftp://sourceware.org/pub/cygwin". This sets up apt-cyg to use the official repository when downloading programs.

Install packages

Cygwin is really just a shell, so you'll need to install some packages to make it useful. Here's a bunch I suggest to have for 15-122:

You should install these packages using apt-cyg. To install a single package, enter into Cygwin something like "apt-cyg install gcc-core". To install several at a time, use something like "apt-cyg install xinit xorg-docs xterm make". You might find that some of the packages are already installed, and that's okay.

There are tons of packages available to install in Cygwin, including familiar programs like python, idle, git, and zip, so feel free to check them out!

Set up X-Forwarding

I promise this is easier than using X-Win32.

Just enter this into Cygwin: "echo 'export DISPLAY=:0.0' >> ~/.bashrc"

Install C0 Locally (optional)

Enter the following into Cygwin:

  1. mkdir /opt
  2. cd /opt
  3. wget http://c0.typesafety.net/dist/cc0-v0440-cygwin32-bin.tgz
  4. tar -xzvf cc0-v0440-cygwin-bin.tgz
  5. rm cc0-v0440-cygwin-bin.tgz
  6. echo 'export PATH=/opt/cc0/bin:$PATH' >> ~/.bashrc

How do I use Cygwin?

How to SSH into AFS

Just use "ssh <andrewid>@unix.andrew.cmu.edu". For example, since my AndrewID is adbenson, I would type "ssh adbenson@unix.andrew.cmu.edu".

How to SSH into AFS, but with X-Forwarding enabled

First type "xwin -multiwindow &" so that X-Forwarding begins running, then SSH with the -Y flag, as in (for me) "ssh -Y adbenson@unix.andrew.cmu.edu".

How to run C0 Locally

First, make sure you've installed C0 Locally, as detailed above. Then you should be able to use coin or cc0 just like on AFS.

How to Troubleshoot

Josh Korn (jkorn) and I (adbenson) both have some experience in setting up and using Cygwin. If you post on Piazza or email us, we would be glad to assist you in any way we can.