Notes on installing Cygwin

These are my notes to document my Cygwin setup. This is certainly not the only way to install Cygwin. For brevity, I've used my personal folder names below, i.e. c:\frank, c:\frank\Run Periodically. There is nothing special about these names; adjust them to suit your preference.

  • Download setup.exe. Save to c:\Frank\Run Periodically\cygwin-setup.exe
  • Run cygwin-setup.exe:
    • Select "Install from Internet"
    • Set "root directory" to c:\frank\cygwin
    • Set "Install for All Users"
    • Set "Default text file type" to "Unix/binary"
    • Set Local Package Directory to c:\frank\Run Periodically
  • Add these packages to the default install:
    • rxvt, unzip, zip, zsh
  • From My Computer -> Properties -> Advanced -> Environment Variables, make a new variable HOME=c:\frank

rxvt

Think twice about this ...
Command-line applications that require interactive input will freeze when running under rxvt due to rxvt using ptys and normal apps not understanding them. A better solution is to run zsh in a "DOS box" as shown below.
Make a shortcut on the desktop to c:\Frank\cygwin\bin\rxvt.exe:
  • Set the Target to:
    C:\Frank\cygwin\bin\rxvt.exe 
         -fg white -bg black +sr -sl 2000 
         -fn "-*-courier new-medium-r-*-*-*-15-*-*-*-*-*-*" 
         -e /usr/bin/zsh
  • Set Start in to c:\frank

zsh in a "DOS box"


To run zsh in a "DOS box", make a shortcut on the desktop to c:\Frank\cygwin\bin\zsh.exe:
  • Set Start in to c:\frank
  • "DOS boxes" are not resizable on-the-fly, however you can set a larger size by clicking "Layout" and adjust the Window Size. Make sure the Screen Buffer width is equal to the Window size width you set so there isn't a horizontal scroll bar.
  • Set the Screen Buffer height to a large value (e.g. 1000) to enable a large scrollback buffer.
  • From the "Options" tab, turn on "QuickEdit mode". This allows copy & paste editing to/from the window:
    • To copy: Highlight text in window and right-click to copy to clipboard.
    • To paste: Copy text from somewhere into the clipboard. Right-click to paste.

Voila! 99% of the benefits of rxvt and you can also run interactive apps.

Keyboard + zsh


Some nice keybindings for your .zshrc, known to work at least in a DOS box:
# make DEL work inside a DOS box
bindkey "\e[3~" delete-char
# HOME/END key (BTW, you can capture keycodes with Ctrl+V+key)
bindkey "\e[1~" beginning-of-line
bindkey "\e[4~" end-of-line
Reference: ZSH on Dos/Windows

Text editors


Set your text editor to save files in Unix ("\n") format rather than DOS/Windows ("\r\n") format. This will save you headaches when writing shell scripts that fail to run because of \r characters.

Written in WikklyText.

Comments

Post new comment

The content of this field is kept private and will not be shown publicly.