Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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?

share|improve this question
How did you install it and where did you install it to ? – Sathya Nov 27 '10 at 5:00

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:

share|improve this answer

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.

share|improve this answer

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?

share|improve this answer

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

share|improve this answer

You must log in to answer this question.

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