Installing Ruby 1.9.1 and Rubygems alongside Existing Ruby

Tagged with Ruby

Language: Apache

Follow these instructions to get everything compiled. Install gems like this:

sudo /opt/ruby1.9/bin/gem-1.9 install rails

Add /opt/ruby1.9/bin to your path to ease typing.

View as text

mkdir tmp
cd tmp

wget http://ftp.gnu.org/gnu/readline/readline-5.2.tar.gz
tar zxvf readline-5.2.tar.gz 
cd readline-5.2
./configure --prefix=/usr/local
make static
sudo make install-static
cd ..

wget ftp://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.1-p0.tar.gz
tar zxvf ruby-1.9.1-p0.tar.gz 
cd ruby-1.9.1-p0
./configure --program-suffix=-1.9 --with-readline-dir=/usr/local --prefix=/opt/ruby1.9 --enable-shared
make
sudo make install
cd ..

wget http://rubyforge.org/frs/download.php/45906/rubygems-1.3.1.tar.gz
tar zxvf rubygems-1.3.1.tgz
cd rubygems-1.3.1
sudo /opt/ruby1.9/bin/ruby-1.9 setup.rb
cd ..
Original snippet written by Brian Hogan
Last updated at 15:35 PM on Mar 03, 2009 by Brian Hogan

SnippetStash costs money to host and develop. The service is free for everyone to use
but if you found it useful please consider making a small donation.