Ubuntu – Install ruby 2.0 without ruby-switch

rubysoftware installation

I'm finding the task of installing ruby 2.0 on the latest Ubuntu 14.04 rather frustrating. I'm aware that I could forgo the packages and install from source – but I'd far rather install a package – if that is possible.

I found this question/answer about ruby on 13.10 – which looked like what I wanted.

How to install ruby?

Unfortunately, the strategy doesn't seem viable – the ruby-switch package has been deleted in 14.04.

http://www.ubuntuupdates.org/package/core/trusty/universe/base/ruby-switch

The deletion of the package references a bug which, to me, looks entirely unrelated.

I'm bemused about why installing ruby2.0 using apt-get installs ruby1.9 and makes it the default ruby interpreter. I do get a ruby2.0 binary – but scripts (which depend upon a 2.0 interpreter when executing ruby) don't pick it up. Furthermore, when I use gem et. al. to install ruby packages – these seem to be installed for ruby1.9 rather than 2.0. Very unsatisfactory.

Can anyone offer a hint as to the most straightforward way to install ruby 2.0 as the standard ruby interpreter? How am I expected to switch from ruby 1.9 to 2.0 without ruby-switch?

Best Answer

For 14.04 I found the following PPAs that come with Ruby 2.x

  • Adds Ruby 2.1 to Ubuntu 14.04

    sudo add-apt-repository ppa:brightbox/ruby-ng
    

I also found in GoRails a set of instructions to install Ruby on 14.04 but I am guessing since they are long you would want a PPA instead.

  • Adds Ruby 1.9, 2.0 or 2.1 to Ubuntu 14.04

    sudo add-apt-repository ppa:brightbox/ruby-ng-experimental
    

After you add one of them simply:

sudo apt-get update
sudo apt-get install ruby2.1 # In the case you want 2.1