How to Install Ruby RVM

, , …,

This page is a quick guide on installing RVM on Linux. I assume you are using Ubuntu 12.04 or later.

RVM is used to install and manage multiple environment/version of Ruby.

If you are new to ruby, see: How to Install Ruby; What's RVM, Gem, Rake, Bundler, RDoc, ri, irb?.

Install Prerequisites

Run these and you should have the prerequisites (https://rvm.io/rvm/prerequisites/):

sudo apt-get install build-essential curl git subversion

Install RVM

Run sudo apt-get install ruby-rvm.

Alternatively:

To install RVM, follow instructions on their site at: https://rvm.io/rvm/install/

basically just run this:

\curl -L https://get.rvm.io | bash

After you have run the above shell code, it'll:

You might need to copy that line to the end of your ~/.bashrc file (because a earlier version doesn't add it to ~/.bashrc). Then, close the terminal and start a new terminal.

RVM Dir Structure

RVM is a collection of COMPLEX bash shell scripts and functions, and doesn't follow standard practices.

Once installed, all Ruby installations and libs will be installed under the ~/.rvm dir.

For the rvm dir structure, see: Ruby: RVM Directory Structure.

Uninstall RVM

To uninstall, just delete the ~/.rvm directory, and delete the lines that adds rvm path in your shell init scripts. Or, you can run rvm implode

Basic RVM Help, Show Version

Type which rvm. It should show 〔/home/‹login›/.rvm/bin/rvm〕.

Type type rvm will show you if it's a shell script or bash function.

Type rvm --help. Sample output: rvm_help.txt. If it comes up, then you know it's installed.

Type rvm --version to show version.

Prerequisites for Other Ruby Libs

AFTER YOU'VE INSTALLED RVM, then type rvm requirements. This will list or install software that many Ruby lib will need (such as Rails). Here's the output:

WARNING: as of , rvm requirements will install stuff instead of just listing. The documentation rvm --help, quote:

requirements  :: Shows additional OS specific dependencies/requirements for
                 building various rubies.

is incorrect.

◆ rvm requirements

Requirements for Linux "Ubuntu 12.04.1 LTS"

NOTE: 'ruby' represents Matz's Ruby Interpreter (MRI) (1.8.X, 1.9.X)
             This is the *original* / standard Ruby Language Interpreter
      'ree'  represents Ruby Enterprise Edition
      'rbx'  represents Rubinius

bash >= 4.1 required
curl is required
git is required (>= 1.7 for ruby-head)
patch is required (for 1.8 rubies and some ruby-head's).

To install rbx and/or Ruby 1.9 head (MRI) (eg. 1.9.2-head),
then you must install and use rvm 1.8.7 first.

Additional Dependencies:
# For Ruby / Ruby HEAD (MRI, Rubinius, & REE), install the following:
  ruby: /usr/bin/apt-get install build-essential openssl libreadline6 libreadline6-dev curl git-core zlib1g zlib1g-dev libssl-dev libyaml-dev libsqlite3-dev sqlite3 libxml2-dev libxslt-dev autoconf libc6-dev ncurses-dev automake libtool bison subversion pkg-config

# For JRuby, install the following:
  jruby: /usr/bin/apt-get install curl g++ openjdk-6-jre-headless
  jruby-head: /usr/bin/apt-get install ant openjdk-6-jdk

# For IronRuby, install the following:
  ironruby: /usr/bin/apt-get install curl mono-2.0-devel

# For Opal, install the following:
  opal: /usr/bin/apt-get install nodejs npm

On linux, be sure you have everything there installed. Or, just execute it, like this:

sudo apt-get install build-essential openssl libreadline6 libreadline6-dev curl git-core zlib1g zlib1g-dev libssl-dev libyaml-dev libsqlite3-dev sqlite3 libxml2-dev libxslt-dev autoconf libc6-dev ncurses-dev automake libtool bison subversion pkg-config
blog comments powered by Disqus