Code and comments

Practical and theoretical aspects of software development

Cygwin setup gotchas

If you have gained any level of skill with the standard Unix/Linux command-line utilities, you will not be content to use cmd.exe. Yet many of us have no choice but to spend our days working on a Windows machine.

Thus the creation of  Cygwin was completely inevitable.

Cygwin is great, but there are a few installations gotchas. Here are four things that tripped me up the first or second time around.

Where am I? Is this my home directory?

So you install Cygwin, fire it up, and try to determine your location:

WILSOE18@NW968271 ~
$ pwd

Good! Let’s find our stuff:

WILSOE18@NW968271 ~
$ ls

WILSOE18@NW968271 ~

Hmm . . . I think we aren’t quite home. Don’t worry about where we are (somewhere inside the Cygwin installation,) where to we want to be? To get to the files we are looking for, use:

$ cd /cygdrive/c/path/to/file

Rather than type out these paths regularly, you will probably want to make some symbolic links (ln -s) to smooth the rough edges.

Why aren’t my favorite utilities here?

Now that we can find our stuff, let’s edit something.

$ vi
-bash: vi: command not found

What? No vi? I thought this was going to make my terminal Linux-y?

It turns out that the default Cygwin installation leaves out a few things that you might expect.

When you are installing Cygwin, don’t miss the “Select Packages” step, pictured below.

Select Package dialog

Click on 'skip'!

To include Emacs, as pictured above, click on ‘Skip’ so that it changes to ‘Keep’. Intuitive? Spend some time searching for you favorite programs and making sure they are included.

How do I install those utilities I overlooked?

So I missed some stuff. Do I run sudo apt-get install [package-name]? Do I have to re-install Cygwin?

Neither. Just run setup.exe again, and select the stuff that you missed. Keep that setup file around, you’ll come back to it again.

Can I have sane copy-paste?

Being experienced with the Windows terminal, I had learned that you could paste with Alt-Space-E-P, and to copy you just Alt-Space-E-K to choose ‘mark’, and then using a combination of the arrow keys and Shift, you carefully choose your selection, before you . . . I always forget how you select it, but if you get it wrong, you have to start all over.

You don’t have to live this way. Cygwin defaults to the standard Windows terminal, but includes the MinTTY terminal in the default installation. All you need to do is point your Cygwin shortcut to mintty.exe which you will find in C:\cygwin\bin, along with 500 or so other files.

Now you can copy with Ctrl-Shift-C, and paste with Shift-Insert, and you can select with your mouse. Remarkably civilized.

Once you clear these obstacles, you should have an extremely tolerable and Linux-y experience that allows you to forget that you are using Windows for hours at a time.


Written by Eric Wilson

August 15, 2011 at 8:00 am

Posted in how-to

Tagged with ,

7 Responses

Subscribe to comments with RSS.

  1. […] It wasn’t obvious how to use it in Cygwin. For more about installing things in Cygwin, read here. […]

    • Can you show what you mean by pointing cygwin shortcut to mintty.exe?

      David Alvarez

      September 12, 2015 at 4:43 pm

      • Not really. I haven’t been a Windows user since 2011. Any old blog posts that I left behind represent all that I’m able to help with Windows/Cygwin.

        Eric Wilson

        September 12, 2015 at 7:19 pm

  2. […] wasn’t obvious how to use it in Cygwin. For more about installing things in Cygwin, read here. I managed to get mit-scheme on my windows machine before, when I was first looking at SICP but […]

  3. Editors doesn’t seem to be an option in my setup. Mine goes … Devels, Doc, Games, Graphics…


    August 6, 2012 at 7:37 pm

    • Sorry, I’m no longer a Windows user, so I won’t be able to help with this. Sorry.

      Eric Wilson

      August 6, 2012 at 9:01 pm

      • No worries! For anyone who encounters the same problem; I was trying to reconfigure/reinstall from my local drive. The ‘Editors’ option reappeared when I re-downloaded cygwin from a mirror. (This windows box is driving me crazy; give me back my linux machine!)


        August 6, 2012 at 9:10 pm

Comments are closed.

%d bloggers like this: