Installing RVM, Ruby, and Rails

You need to install RVM only once (or whenever you want to update to another version of Ruby). Alternatively you may have a look at rbenv instead.

Quick How To

bash -s stable < <(curl -s https://raw.github.com/wayneeseguin/rvm/master/binscripts/rvm-installer)
. $HOME/.rvm/scripts/rvm
rvm install 1.9.3
rvm use --default 1.9.3
rvm cleanup all
gem install rails

Preparations

Standalone, Self-Managed Laptops or Workstations

If you administer your own Linux laptop or workstation you need to make sure to have the necessary tools and libraries installed. E.g. for Debian and Ubuntu as root or with sudo:

apt-get install \
  curl \
  bison \
  build-essential \
  zlib1g-dev \
  libssl-dev \
  libreadline6-dev \
  libxml2-dev \
  git-core

On our D-PHYS Ubuntu and Debian workstations these are already installed.

For Mac OS X you need at least the Xcode tools and Git.

Disabling Documentation Builds (optional)

By default Ruby gems will be installed with their fully formatted rdoc and ri documentation. If you are permanently connected to the internet anyway this is probably a waste of disk space. On the other hand it is convenient to have the documentation for the exact set of gems that you use. Likewise on a Laptop you may want to have the documentation available even if offline or you might feel space constraints on a crowded disk. Consider the pros and cons and if you decide that you don't want the docs in your home directory, add the following line to your $HOME/.gemrc file:

gem: --no-rdoc --no-ri

RVM

At this time of writing the following command should install RVM into you home directory

bash -s stable < <(curl -s https://raw.github.com/wayneeseguin/rvm/master/binscripts/rvm-installer)

RVM will then add its initialization code to $HOME/.bash_profile which will be activated with the next new login shell.

For the current shell you can call

. $HOME/.rvm/scripts/rvm

explicitly. Shells other than bash might have slightly different but similar configuration commands.

For more details read the RVM installation guide.

If you want to update RVM use

rvm update --head

Ruby

With rvm you can have several versions of Ruby installed in parallel.

To see the available versions use

rvm list known

For Ruby 1.9.3 use (analogous for other versions)

rvm install 1.9.3

To see the installed versions use

rvm list

You can then switch between them, e.g. with

rvm use 1.9.3

Or you can set one as the default, e.g. with

rvm use --default 1.9.3

Each Ruby maintains its own set of gems. To update all gems use:

gem update --system

Rails

Rails (or any other gem) is installed with the gem command:

gem install rails