Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

People also ask

How do I change Ruby version in Ubuntu?

To see what Ruby versions you have installed, run rvm ls . To switch between Ruby versions, run rvm use <version_number> (for example, rvm use 2.7.

How do I install a specific version of Ruby?

Use `gem install -v` You may already be familiar with gem install , but if you add the -v flag, you can specify the version of the gem to install. Using -v you can specify an exact version or use version comparators.

Does Ubuntu come with Ruby?

Not by default. Nothing in the default install uses it, so it's not installed.


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

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.


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.


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.)