Forum: Ruby Installed Ruby 1.9.1 but ruby -v gives 1.8.7

Posted by Max You (max-you)
on 2011-06-05 02:22
I'm trying to update Ruby on my Ubuntu system. What should I do after
installing Ruby 1.9.1?

Since ruby -v gives 1.8.7 I'm assuming there are probably some
configuration changes I need to do. But I have no idea what.

I'm very new at Linux as well.
Posted by jake kaiden (lljk)
on 2011-06-05 02:43
try "ruby1.9.1 -v"
  and to run code under 1.9.1 - "ruby1.9.1 foo.rb"

  1.8.7 is still your system default ruby. there may well be other ways, 
but i have used both rvm and update-alternatives to switch between 
multiple versions of ruby.  if you've installed both versions from the 
ubuntu repository, update-alternatives should work well for you...

http://www.veebsbraindump.com/2010/08/supporting-multiple-ruby-versions-on-ubuntu-10-04-lucid/

  - j
Posted by Agent Mulder (datura)
on 2011-06-06 21:38
From the command line, type

$ which ruby

/usr/bin/ruby (on my machine)

Go to the directory specified and type

$ ls ruby*

You'll probably see 'ruby1.8', 'ruby1.9.1' and 'ruby' plain side by side 
in the directory. The last one, 'ruby', is most likely a link to 
ruby1.8. Try to delete the link and remake it, pointing to ruby1.9.1 
instead.
Posted by Dan Connelly (djconnel)
on 2012-02-23 05:10
% sudo update-alternatives --config ruby

will allow selections of ruby version.
Please log in before posting. Registration is free and takes only a minute.
Existing account (Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
No account? Register here.