Cygwin is a great set of Unix/Linux utilities for Windows. Here are quickstart instructions for using it in a Drupal context (for git, patch, ssh, or whatever)
- Grab the small setup.exe from http://cygwin.com
- Run it. If you're on Windows Vista or later, you'll want to run the setup with administrative privileges (Right click on setup.exe and "Run as administrator")
- Take all the defaults - we'll end up with an install in c:\cygwin
- When you get to the package selection screen, select at least: openssh, git, rxvt, patch, patchutils, telnet, unzip, nano, vim, rsync, wget, connect-proxy. Then let it download and install.
- Run "Rxvt Native" from the start menu. (If on Vista or later, you need to run it as administrator this time because we'll be setting up links in a privileged directory). The first time you do this it will install default profile files for you.
- In rxvt we'll now set up symbolic links to the Windows filesystem. Do this for each drive you have... I'm showing the C: and D: drives here:
cd /
ln -s /cygdrive/c
ln -s /cygdrive/d
- Now you can navigate into the Windows filesystem to wherever your Drupal install is. /c is the root of the C: drive; /d is the root of the D: drive. For example, if you have Acquia's DAMP installed, it might be in /c/Users/rfay/Documents/Sites/acquia-drupal or something like that.
- Using cvs, you could check out the Examples project, for example:
export CVSROOT=:pserver:anonymous@cvs.drupal.org:/cvs/drupal-contrib
cvs login (your password is 'anonymous')
cvs -z6 checkout -d examples-HEAD contributions/modules/examples
and now you have a HEAD version of Examples. - Using git you could get Examples from git.drupalfr.org:
git clone git://git.drupalfr.org/git/contributions-new-date/examples.git
- Or apply a patch using patch.... or create a patch using git diff --no-prefix...
The world is your oyster. You have the easy-to-use editor nano if you want to edit within Cygwin, but you can just use the Windows editor of your choice as well.
You may also want to watch the Lullabot video on installing Cygwin, which is old, but still useful and valid.
Edit: You can now use drush successfully on Windows! See Installing Drush on Windows Using Cygwin.
Comments
Wim Mostrey (not verified)
Mon, 2010-08-16 00:26
Permalink
Cygwin + Drush
One other great use I can imagine for Cygwin is Drush. There appear to be a couple of issues to get Drush (and Drush 3 specifically) running with Cygwin though. I think a lot of people would appreciate a follow-up article on Cygwun + Drush. It looks like it hasn't been done before.
rocksoup (not verified)
Mon, 2010-08-16 01:48
Permalink
Drush 3 + Cygwin
I set up Cygwin with Drush 3 today using this: http://drupal.org/node/594744 and a similar approach to the method above. Drush 3 on window$ ftw!
greg.1.anderson (not verified)
Tue, 2010-08-17 08:36
Permalink
Drush + Windows
Drush + Windows has definitely been done, but there are a few issues. I just committed a Windows-related fix to drush-HEAD; we could definitely use some good Windows hands in the drush queue to suggest and test patches.
Thanks for the great cygwin article.
David Corbacho (not verified)
Mon, 2010-08-16 01:20
Permalink
Mintty
I personally recommend to grab in the package selection "mintty". It's an alternative interface over Cygwin that makes everything nicer visually and more natural behaviors for Windows-users like selection of text, Right Click -> Copy, windows resizable, Drag&drop etc
Also can be grabbed as a standalone program http://code.google.com/p/mintty/
Andy (not verified)
Mon, 2010-08-16 05:08
Permalink
Also, unlike rxvt it supports
Also, unlike rxvt it supports Unicode (i.e. UTF-8), which is the default in latest Cygwin.
mikeytown2 (not verified)
Mon, 2010-08-16 02:26
Permalink
andLinux
I'm a huge fan of andLinux
http://www.andlinux.org/
http://drupal.org/node/505974
Vacilando (not verified)
Thu, 2012-01-05 15:55
Permalink
Still now?
I am interested to know -- are you still using andLinux, mikeytown2, or have you moved to a more promising system?
smk-ka (not verified)
Mon, 2010-08-16 20:59
Permalink
Typing by hand?!
Are you serious ;) To get an Explorer context menu entry for directories instead, you
<
ul>
chere -i -t mintty -e "&Bash Here"The -e option allows you to change the text to be shown in the context menu to your likings.
AaronELBorg (not verified)
Wed, 2010-08-18 00:16
Permalink
I wish the windows keyboard
I wish the windows keyboard shortcuts stuff was more reliable. It works......occasionally.
I hate having to grab the mouse and click on an icon to simply open up a gd shell.
What's the key here??
blainelang (not verified)
Mon, 2010-10-18 09:09
Permalink
had to also specify the --binary option with patch
Randy, I found your article looking for a solution to errors I was getting trying to apply a patch using Cygwin:
Using the --binary option solved this for me.
as in:
$ patch -p0 --binary < /cygdrive/f/depot/patches/filedepot-use_url_for_links.patch
rfay
Mon, 2010-10-18 09:25
Permalink
Cygwin with Linux line endings?
I suspect you may have installed cygwin not taking the default line ending setup (which is to use Unix/Linux line endings) and instead using Windows line endings. I haven't had this problem patching in cygwin myself. But since Cygwin is really a Linux environment, it's important to use the Unix/Linux-style line endings when doing cygwin.
Vacilando (not verified)
Sun, 2012-01-29 09:35
Permalink
Symbolic links incompatible with drush
The symbolic linking mentioned in the article (e.g.
ln -s /cygdrive/c) has a problem with drush. I've installed drush 5 with WAMP today easily thanks to http://drupal.org/node/594744 but simple downloads such asdrush dl develwere being installed in a Windows folder of the same name as the symbolic link.E.g. on site "/c/www" (folder "www" on C drive) the above drush command created a folder "c" on C drive.
Solution: avoid the symbolic links and simply run drush on the default cygwin path, e.g. "/cygwin/c/www".
Vacilando (not verified)
Wed, 2012-02-08 10:25
Permalink
I meant: avoid the symbolic
I meant: avoid the symbolic links and simply run drush on the default cygwin path, e.g. "/cygdrive/c/www"!
Peter Cossey (not verified)
Wed, 2012-02-08 07:46
Permalink
Update for Drush 5 and Windows 7
Hey Randy your article really helped me setup Drush on a Windows 7 machine, I created a page for the Drupal Community Docs here: http://drupal.org/node/1432756
As usual you make it look easy!
rfay
Wed, 2012-02-08 08:49
Permalink
Added to the article
Thanks so much. I added the link to the article. Thanks for pioneering and documenting this great work.