It’s just data

Rails 3.0 on Cygwin

Rails 3.0 requires 1.8.7 or later. Both InstantRails and the (current, released) version of RubyInstaller bundle Ruby 1.8.6.  The files on the Ruby site seem to be a scavenger hunt.  While the next release of RubyInstaller will address this, we can run today with Cygwin.

On the right of the Cygwin page you will find a link to “Install Cygwin now”.  The UI for the installation is a little unusual, the basic process is documented here.

When you get to step 15 (yes, step 15), you will want to select the following:

Hint: I find it is easiest to first click on view (top right) to get a alphabetical list of all packages, then use the search box (top left) to filter the list, and then select the individual packages.

Cygwin itself provides a minimal shell window.  You can use the Console program to give you a nicer window.  This program doesn’t have a proper installer, instead you simply unzip the file you downloaded.  In the directory that produced, create a shortcut to the Console executable (right click on Console, select “Create shortcut”) and then drag that shortcut out to some place where you can find it later (e.g., desktop or quick launch toolbar).  Launch a Console window using this shortcut to see a Windows command prompt.  Select Edit -> Settings, and set the shell to C:\cygwin\bin\bash -l.  Select OK, then exit and relaunch the console and you now have a bash prompt.

Notepad++ is a free editor that understands Unix conventions.  Select and run the installer from here.  Launch Notepad++, and from there navigate to your bash configuration file:

  File → Open → Computer → c: → cygwin → home → yourname → .bashrc

Insert the following at the bottom:

alias edit='cygstart "/cygdrive/c/Program Files (x86)/Notepad++/notepad++.exe"'

You might need to adjust this path slightly.  On Windows XP, for example, I don’t seem to have the “ (x86)” part.  Once complete, save the file.  Now close any open Console windows and launch a new one.  Inside that console, execute the following commands:

wget http://rubyforge.org/frs/download.php/60718/rubygems-1.3.5.tgz
tar xzf rubygems-1.3.5.tgz
cd rubygems-1.3.5
ruby setup
cd ..
gem install sqlite3-ruby

Now you can install rails normally (gem install rails), or checkout the latest using git.  You can now edit files (e.g., config/database.yml) using the alias you set up:

edit config/database.yml

Results following the scenario described in AWDwR3 closely match results on Ubuntu.


May I also recommend the mintty package that comes with cygwin - IIRC it’s based on the terminal used by putty and is very nice to use.

J.

Posted by John at

“ (x86)” indicates a 32bit installation on Windows x64.

Posted by James at

John: thanks!  I personally have been using putty for a while, didn’t feel it was worth recommending to people who are new to this.  mintty, however, does seem to be something I could recommend.

James: thanks, that does explain the difference.

Also worth mentioning: scripts that automate the setup.

Posted by Sam Ruby at

BitNami RubyStack includes Ruby 1.8.7 and 1.9.1p0.

Posted by anonymous at

Cygwin also has rxvt, derived from xterm (but doesn’t need an X server under Windows).

Posted by Ken MacLeod at

Add your comment