Setting up a Ruby 1.9 Sandbox on Leopard
Thursday, August 21, 2008 at 09:44AM The next version of Ruby is right around the corner and it is propably time to start getting used to the changes and start making your code compatable to the new version. Since it's not a good idea to overwrite your existing ruby installation you should propably install a Ruby 1.9 sandbox with the following directions. Although I did this on a Mac OS X.5 machine the directions should work fine for Linux. Lets start with downloading Ruby and installing in /opt.
cd /tmp
curl http://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.0-3.tar.gz | tar zx
cd ruby-1.9.0-r18217
autoconf
./configure --prefix=/opt/ruby19
make
sudo make install
Now lets set up a command that puts you in the 1.9 sandbox when needed. Open up the file .profile in your home directory or create it if it does not exist. Add the following line
alias ruby19="export PATH=/opt/ruby19/bin:$PATH"
Close the Terminal window and open up again. Now everytime you need to put a terminal window into the Ruby 1.9 mode just type in the command ruby19. Try it out with the command ruby -v and you should see the reply:
ruby 1.9.0 (2008-07-25 revision 18217) [i686-darwin9.4.0]
Now just have fun in the sandbox. Remember that there now is a seperate gem repository so you need to get the gems you need with the gem command. For info on changes in Ruby 1.9 take a look at the Ruby 1.9: What To Expect or Migrating to Ruby 1.9 slideshows.


Reader Comments (3)
Thank you for posting this short howto on setting up a ruby 1.9 sandbox. This will definitely help with my plan to test my libraries and the common libraries I depend on daily with Ruby 1.9.
Nice and easy. And it works. :)
Thanks! It worked except for some reason, my terminal doesn't recognize my .profile, only .bash_profile