How do I make Ruby 1.9 the default Ruby on Ubuntu?

RubyUbuntuRuby 1.9

Ruby Problem Overview


Is there any way, on Ubuntu 9.04, to install Ruby 1.8 as ruby1.8 (or get rid of it altogether) and have Ruby 1.9 be the default ruby?

Ruby Solutions


Solution 1 - Ruby

I'm not really sure, but maybe this can help:

update-alternatives --config ruby

... and here's the non-interactive, scriptable, way:

update-alternatives --set ruby /usr/bin/ruby1.9.1

You may find out about available alternatives and respective /usr/bin/... paths by doing:

update-alternatives --query ruby

Solution 2 - Ruby

Martin - Take a look at the following link: http://ryanbigg.com/2010/12/ubuntu-ruby-rvm-rails-and-you/

This is where installation of ruby is heading for ubuntu servers. This should allow you to not only switch to a ruby version when needed, but also keep gems separated based on ruby versions, etc.

Solution 3 - Ruby

You can completely remove Ruby 1.8 too with:

sudo apt-get remove libruby1.8 ruby1.8 ruby1.8-dev rubygems1.8

After that, you will only have Ruby 1.9 installed.

Solution 4 - Ruby

sudo \curl -L https://get.rvm.io | bash -s stable --ruby --rails

will install an up-to-date version of ruby (and rails), and allow you to avoid brokenness of Ubuntu's RVM, see https://stackoverflow.com/a/9056395/497756.

If you go this route, get rid of Ubuntu-installed versions and associated packages like bundle.

Details here: https://rvm.io/rvm/install/

(Note: this is the TL;DR version of the post by henry74.)

Solution 5 - Ruby

Try this:

sudo apt-get install ruby1.9.1 rubygems1.9.1

or try building from source. this worked for me on ubuntu 9.04 and after a restart 1.9 was the standard ruby

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionMartin DeMelloView Question on Stackoverflow
Solution 1 - Rubyjust_a_dudeView Answer on Stackoverflow
Solution 2 - Rubyhenry74View Answer on Stackoverflow
Solution 3 - RubyTravis ReederView Answer on Stackoverflow
Solution 4 - RubyJoe CorneliView Answer on Stackoverflow
Solution 5 - Rubyuser214028View Answer on Stackoverflow