Ruby 1.9.1 preview now available
Ruby 1.9.1 preview 1 was released yesterday. Though a binary distribution is not yet available for Mac OS 10.5 (Leopard), it is quite easy to install it from source. Firstly, make sure that you have Apple’s developer tools installed – they come on the same disk as Mac OS. Better still, download and install the latest iPhone SDK, and you’ll automatically make sure that you have all the tools required to build Ruby from source.
Fire up terminal, and give the following command to download and extract the Ruby 1.9.1 preview:
cd /tmp curl http://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.1-preview1.tar.gz | tar xz cd ruby-1.9.1-preview1
Now we’ll build it. This will take a few minutes:
autoconf ./configure --prefix=/opt/ruby19 make
The –prefix=/opt/ruby19 will ensure that Ruby 1.9.1 preview is installed under /opt and doesn’t muck with the version of Ruby that comes with Mac OS (1.8.6 on Mac OS 10.5.5).
Finally, we issue the following command to install what we just built:
sudo make install
That’s it! You can run it from /opt/ruby19/bin/
/opt/ruby19/bin/ruby -v ruby 1.9.1 (2008-10-28 revision 19983) [i386-darwin9.5.0]
On a related note, Jon has a wonderful suggestion about adding an alias to your ~/.profile which places /opt/ruby19/bin in your path before /usr/bin.
