Cygwin version of Ruby is currently broken

Apparently the version of Ruby in the current Cygwin Ruby package has a bug that breaks the latest version of Rails.

I decided to play round a little with Rails 2.0 the other day.  When I ran the “rails” command to create a new project, I got an error message about /dev/urandom (sorry, I should have written it down).   After doing a few google searches, I discovered it’s apparently a bug that’s been recently fixed in Ruby.  (see this bug report).   Unfortunately, the Cygwin package of Ruby still hasn’t been updated to the fixed version.

If you run Ruby under Cygwin, here’s a workaround until there’s an updated Cygwin Ruby package:

1) uninstall any gem’s you’ve installed (run “gem list –local” , then do a “gem uninstall” for each one.)

2) use the Cygwin setup application to uninstall the Cygwin version of Ruby.

3) while you’re in the Cygwin setup application, make sure you’ve installed the openssl-devel package.  If you don’t, Ruby will appear to compile correctly, but it’ll be missing crypto support that’s necessary for the latest versions of Rails.

4) download the latest stable snapshot release of the Ruby source.

5) untar the Ruby source to the directory of your choosing (I recommend /usr/local/src).

6) follow the instructions in the included README to install.   (./configure; make; make install)

7) Download the latest version of Ruby Gem

8) untar to the directory of your choosing (I still recommend /usr/local/src ).

9) follow the instructions in the included README to install ( ruby setup.rb)

10) use gem to reinstall any gems you need, like rails.

It actually takes a lot less time to do than it sounds like it would.  Hopefully there’ll be an updated Cygwin package soon, but until then, this is the best solution.   I did try to use the Ruby One-Click Installer for Windows, but using that under Cygwin is just an enormous pain in the ass.

Advertisements

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