Code and comments

Practical and theoretical aspects of software development

Cygwin setup gotchas

with 5 comments

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
/home/WILSOE18/

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.

About these ads

Written by Eric Wilson

August 15, 2011 at 8:00 am

Posted in how-to

Tagged with ,

5 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. […]

  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…

    Viv

    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!)

        Viv

        August 6, 2012 at 9:10 pm


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

Join 171 other followers

%d bloggers like this: