Posts Tagged ‘cygwin’

Setting up Cygwin

Wednesday, September 19th, 2012

CygwinThis is my procedure for installing Cygwin on a Windows desktop. There are many ways to configure the Cygwin environment. This seems to work for me:

  1. Go to
  2. Download the Cygwin installer/updater to your desktop
    1. Choose setup_x86.exe (32-bit installation), or
    2. Choose setup_x86-64.exe (64-bit installation)
  3. Run it

Use the following settings to answer the setup questions:

Root dir:  c:\cygwin  (for 32-bit; or c:\cygwin64 for the 64-bit install)
Install for:  All users
Default file type:  DOS
Package dir:  c:\cygwin_install (recommended; can be deleted later)

Be sure to install the following packages:

Section  Package
------- -------
Net     inetutils
Net     ncftp
Net     openssh
Net     ping
Python  python
Python  python-imaging
Python  python-tkinter
Shells  chere
Shells  mintty
Shells  tcsh
Shells  xterm (for resize)
Utils   ncurses (for tset)
Web     wget

Set the HOME environment variable in Windows (Computer->Properties->Advanced->Environment Variables) (put your username instead of username):

Win XP:
HOME  c:\Documents and Settings\username
Win Vista/7/8:
HOME  c:\Users\username

Optional environment variables:

$OSG_HOME (OpenSceneGraph)

Set the PATH environment variable. Cygwin will inherit the Windows PATH, but you need to add the directories containing the Cygwin executables. This is a very minimal .cshrc file. You will probably want to add a more sophisticated one. I have a small set of “dot” files that I copy into a user’s HOME directory when setting up Cygwin. To create the minimal .cshrc file, type the following lines at a shell prompt, ending with the <Ctrl-D> (Cygwin EOF) character:

/usr/bin/cat > $HOME/.cshrc
set path=(/usr/local/bin /usr/bin /bin $path)
setenv CYGWIN nodosfilewarning

Run the following commands (put your username instead of username):

Win XP:
/usr/bin/mkdir /home
cd /home
/usr/bin/ln -s /cygdrive/c/Documents\ and\ Settings/username/My\ Documents username
Win Vista/7:
/usr/bin/mkdir /home
cd /home
/usr/bin/ln -s /cygdrive/c/Users/username username


mintty shortcut:

C:\cygwin\bin\mintty.exe -i /Cygwin-Terminal.ico /bin/tcsh

Create ~/.Xdefaults containing the following:

rxvt.scrollBar_right: True
rxvt.visualBell: True
rxvt.cursorColor: red
rxvt.saveLines: 5000
rxvt.geometry: 80x40
rxvt.font: courier
rxvt.foreground: black
rxvt.background: white
xterm.scrollBar_right: True
xterm.visualBell: True
xterm.cursorColor: red
xterm.saveLines: 5000
xterm.geometry: 80x40
xterm.font: Consolas
xterm.foreground: black
xterm.background: white

Put mintty in the Windows Explorer folder right-mouse menu:

Run the following command to create a Windows Explorer context menu entry:

/usr/bin/chere -if -t mintty -s tcsh -e "Cygwin Terminal Here" -o "-i /Cygwin-Terminal.ico"

If you get an error like this:

Error (5): Access is denied.
/usr/bin/chere Error: Hive not writable
/usr/bin/chere: Aborting.

it is a UAC (permissions) problem.  Launch the shell as Administrator and try it again.

Modify /etc/csh.login as follows, to let the shell run by chere start in the proper directory:
Replace the last line:



if ( ! ${?CHERE_INVOKING} ) then

Which Cygwin package contains a file?

Thursday, July 1st, 2010


You never have all the tools you need.  For Cygwin, I used to hunt through the package list and guess which package had what I was looking for.  Well there is a better way.  And someone else has already written about it.

This link tells you how to determine which Cygwin package contains a file.

In case that site disappears, here’s how (pretend we are looking for the strings command):

  • There’s a web way:
  • and there’s a command line way (if you already have Cygwin installed):

        cygcheck -p strings.exe

…and the answer is… binutils!

How to squelch the Cygwin DOS path warning

Wednesday, March 17th, 2010

CygwinIn Cygwin version 1.7 they added a “feature” that would warn you about using DOS-style paths on the command line.

my-cygwin-pc> cd c:/<TAB>cygwin warning:
 MS-DOS style path detected: c:/
 Preferred POSIX equivalent is: /cygdrive/c
 CYGWIN environment variable option "nodosfilewarning" turns off this warning.
 Consult the user's guide for more details about POSIX paths:

At least this only happens the first time during the session, but I still wanted it gone.

So I tried to turn it off, but the instructions were a little ambiguous to me.  I tried setting a nodosfilewarning environment variable in my .cshrc.  I actually tried it several different ways:

setenv nodosfilewarning 1
set nodosfilewarning=1

Turns out none of these are right.  You need to set a Windows environment variable named CYGWIN:


Mystery solved.