Ruby 1.9.1 / 1.8.7 “dual” mode on Ubuntu

I think this may be the most convenient way to have the shinny new Ruby 1.9.1p0 to play and a normal Ruby 1.8.7 on Ubuntu:

  • Install Ruby 1.8.7 and everything else from apt/synaptic
  • Download and extract Ruby1.9.1
  • Use –program-suffix=1.9 while configure to “tag” all the executables
tar jxvf ruby-1.9.1-p0.tar.bz2
cd ruby-1.9.1-p0/
autoconf
./configure --prefix=/usr/local --program-suffix=1.9 --enable-pthread --enable-shared
make
sudo make install
ruby --version
ruby1.9 --version
irb
irb1.9

Try Time.now.to_s inside irb to check differences.

Reference: http://programblings.com/2008/11/18/installing-ruby-19preview1-on-os-x-leopard/