I have Ruby 2.0.0 installed on Ununtu 14.04 but I can't remove Ruby 1.9.1. I replaced the /usr/bin/ruby symbolic link to ruby2.0.0, but hhen installing new gems I always get pointed to Ruby 1.9.1.
How can I definitely switch to Ruby 2.0.0?
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It only takes a minute to sign up.Sign up to join this community
For Ruby, the basic dependency structure goes like this:
ruby(which would ideally be a metapackage that points to the default version) depends on
I'm not sure why they did this, or why they removed the ability to use alternatives here, but if you want to force the use of Ruby 2.0, then one non-invasive way to do this is to create symlinks to the 2.0 binaries. The snippet below will create symlinks in
for i in erb gem irb rdoc ri ruby testrb; do sudo ln -s /usr/bin/$i''2.0 /usr/local/bin/$i done
Ruby 1.9.1 is still accessible by appending
1.9.1 to the binary name (for example,
As an alternative to hand-maintaining multiple symlinks, I suggest using
update-alternatives. In another question, I provided a script to handle all binaries and man pages in ruby versions 1.9.1 and 2.0 (as currently found in my 14.04 system), though the script is easily extended to different versions.