Installing and Configuring Ruby 1.9 from Source Using Cygwin

By , May 31, 2010

If you are developing Ruby on Rails apps on Windows then chances are you will want to use Cygwin. Cygwin provides a Unix like shell on top of the Win32 API so you can follow tutorials and easily use utilities like SSH and Git. If you are planning to use Ruby 1.8.7 then installation is easy, you can just select the package from the Cygwin setup and voila.

image

If however you want to use Ruby 1.9 you will have to compile it from source from within Cygwin. There are a few ‘gotchas’ so here is how to do it.

First off you will need to install a few development libraries into your Unix environment. You will need to default selected configuration + ‘make’ + ‘gcc’ + ‘libiconv’ + ‘openssl’. You install these by selecting them in the Cygwin setup UI (you can use the search or navigate the tree structure) and installing directly from there.

image

Next you will need to download the Ruby 1.9 source (ruby-1.9.1-p378.tar.gz in my case but the build number will vary depending on when you are reading this) from http://ruby-lang.org/ into your home directory.

image

You can then ‘tar xvf ruby-1.9.1-p378.tar.gz’ to unzip the files.

image

cd ruby-1.9.1-p378 and issue a ‘. / configure’

image

(Note: this takes 15 minutes or so as it checks and configures a lot of things)

When this has completed you issue a ‘make’ command

image

When this is complete you issue a ‘make install’ command

image

When this is complete you can test the installation with a ‘ruby –v’ command

image

Voila! Next post will cover installing Rails under Cygwin.

Share on TwitterSubmit to reddit
  • http://www.somnology.org Alexander Hill

    Thanks for the tutorial, it’s helpful to have up to date Ruby running in Cygwin instead of needing a full VM!

  • Huw Walters

    Hi Mark, thanks for the excellent advice; just what I was looking for. However, may I suggest including the “readline” library in the suggested Cygwin configuration, along with “make”, “gcc”, “libiconv” and “openssl”? This does not appear to be installed by default; and without it, you don’t get the full functionality of irb!

    Huw

  • Pingback: Ruby on Rails in Cygwin « f i c i a l

  • http://ficial.wordpress.com Chris

    Thanks for this write up! It started me on the right track, though I encountered problems with win32ole at the compile step – http://ficial.wordpress.com/2011/05/24/ruby-on-rails-in-cygwin/. If you have any thoughts about better approaches than I took (configuring without that extension)I’d be very interested in hearing them (my linux admin skills are moderate at best).

  • ocj

    Thank you for this, I’m new to the whole open-source thing, and learning Ruby under Cygwin, to become familiar with operating in a linux/unix environment. Without these helpful instructions, it would have taken me much longer to perform this, I may not have even done it, as I have no one to ask when I get stuck. Thank you very much for sharing this with the novices.

  • Pingback: Windows Mac-alike Rails Development Environment | Mehigh

Panorama Theme by Themocracy