Installing Ruby

It is preferred to use the default Ruby interpreter provided with the system. Ruby is in the repositories of all common linux distributions and can be installed easily using their package manager. When installing Ruby this way, install also the interactive Ruby shell "irb" and the development package for Ruby. On a Debian-based linux distribution, the three packages needed are "ruby", "irb" and "ruby-dev".

However, on computers where it is not available (or when newer version is needed), it is possible to install Ruby in user space.

Usig Ruby Version Manager (RVM)

The most convenient way to install Ruby is to use the Ruby Version Manager (RVM). Here are the commands needed for basic installation that attempts to install also the dependencies.

First, install RVM according to the insructions at the font page at rvm.io

Second, to install Ruby 1.9.3 with all the dependencies in the user space, use the following commands:

source ~/.rvm/scripts/rvm
rvm install --autolibs=rvm_pkg 1.9.3
rvm --default use 1.9.3

To load RVM automatically on login, add the following line to your .bashrc (or do the equivalent in your shell if you are not using Bash):

source ~/.rvm/scripts/rvm

If this fails, refer to the documentation at RVM website. You can also try compiling Ruby yourself from the source code.