Setting up multiruby on Ubuntu

Archived, mostly for my own personal reference: I’ve spent a decent chunk of today on Google and the Ruby mailing list trying to get multiruby set up for testing on a new machine (I use Hoe’s rake multi for testing across multiple Ruby versions), and this is what I’ve come out with. I’ve skipped Ruby 1.9.0, as its Rubygems is not recent enough and it’s not production-ready anyway. You’ll need these packages installed from the Ubuntu repos:

sudo aptitude install build-essential ruby1.8 ruby1.8-dev \
                      libruby1.8 libopenssl-ruby1.8 \
                      zlib1g-dev libzlib-ruby

Without further ado, everything you need to set up multiruby (part of the ZenTest gem). The patchlevel numbers will likely be different from those shown; multiruby_setup will tell you which versions it’s installing so you can find them before compiling.

sudo gem install ZenTest
multiruby_setup update:rubygems
multiruby_setup mri:tar:1.8.6
multiruby_setup mri:tar:1.8.7
multiruby_setup mri:tar:1.9.1

tar zxf ruby-zlib-0.6.0.tar.gz
cd ruby-zlib-0.6.0/
~/.multiruby/install/1.8.6-p368/bin/ruby extconf.rb
make && make install
~/.multiruby/install/1.8.7-p160/bin/ruby extconf.rb
make && make install
~/.multiruby/install/1.9.1-p129/bin/ruby extconf.rb
make && make install

multiruby_setup update:rubygems
multiruby -S gem install --no-ri --no-rdoc test-unit

You can add other Ruby versions if you like, and you’ll probably need to adjust the patch numbers based on what the latest versions are when you install this stuff. Each version will take a few minutes to build and install so don’t be surprised if it takes a while.