What I Learned Today

I set up a local Ubuntu server VM under OS X today to run Passenger and develop on. I've been needing to use Ruby 1.8.6, 1.8.7, and 1.9.1 lately, and it was way easier to set this up on Ubuntu. I learned a few things, though:

  • Ruby 1.9.1 requires Ruby already on your system to compile. Who knew?
  • When compiling Ruby from scratch, there's a disconcerting lack of warnings. I didn't have the development libraries for zlib or openssl installed, and it never said a word. It just failed on most things I'd want to do.

I ended up checking out the Subversion tags for each version under ~/src and then compiling them under ~/lib. I use the following script to switch between them:

if [ -z $1 ]
then
  echo "Usage: useruby <ruby_version>"
  exit 1
fi

rm -f ~/lib/ruby
ln -s ~/lib/ruby-$1 ~/lib/ruby

It's crude, but it works. Add ~/lib/ruby/bin to your PATH and you're set.

Published: 26 Mar 2009