0

I've just installed Ruby 1.9.1 in my Ubuntu 10.10. When I give the command ruby -v in terminal, I'm getting "ruby 1.8.7 (2010-06-23 patchlevel 299) [i686-linux]".

I think the older version of Ruby is still there in the PATH. SO, how do I change this to use the new Ruby instead of the old one?

1
  • 1
    How did you install it and where did you install it to ?
    – Sathyajith Bhat
    Nov 27, 2010 at 5:00

4 Answers 4

1

When Ruby 1.9 is installed from apt it installs as ruby19. If you really want to use this version you can setup an alias in your ~/.bash_profile, something like:

alias ruby='ruby19'

This is kind of a hacky solution. A much better solution would be to run RVM. It's a ruby manager which allows you to have several versions on Ruby installed and seamlessly switch between them. It also makes staying up to date much easier.

Installing RVM is really easy to Ubuntu, I've written a short tutorial here: http://blog.dcxn.com/2011/06/20/setting-up-rvm-on-ubuntu-11-04/

0

Check your /etc/environment file to make sure /usr/local/bin or whatever path your custom ruby build is in exists. You may also need to logout and log back in to update environment variables.

0

run which ruby to check which one in your path got executed first. But the question is how did you install the 1.9.1?

0

Best way to have multiple ruby version is to use rvm. after installing rvm you can install multiple ruby version simply by

rvm install 1.8.7
rvm install 1.9.2
rvm install jruby

switching is even more easy, type (in terminal)

rvm use 1.8.7 --default #to use rvm for this terminal session and also sets ruby 1.8.7 as default ruby version
ruby -v #should give ruby version set for current session
ruby use 1.9.2 #sets different ruby to be used for this session

for complete installation instruction see here

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .