From ArchWiki
Revision as of 17:49, 18 May 2010 by Sirupsen (talk | contribs) (Initial)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Ruby Version Manager (RVM)

RVM is a command line tool which allows us to easily install, manage and work with multiple ruby environments from interpreters to sets of gems.

Installing RVM

To install RVM under Arch Linux, simply install it as a RubyGem:

$ gem install rvm

Once the Gem is installed, follow the instructions given. These involves adding a line to your environments init file. (e.g. ~/.bashrc) And then running:

$ rvm-install

Note: Above commands may have to be run as the superuser.

Using RVM

Here's some RVM usage examples, for general usage no more is needed.

Installing an environment

To install a Ruby environment, run:

$ rvm install <environment/ruby version>

For example, to install Ruby 1.8.7 one would run the following command:

$ rvm install 1.8.7

This should download, configure and install Ruby 1.8.7.

Listing Ruby Environments

To see all available Ruby environments, run the following command:

$ rvm list

This would generate a list like so:

~> rvm list
rvm Rubies
   jruby-1.5.0 [ [i386-java] ]
=> ruby-1.8.7-p249 [ i386 ]
   ruby-1.9.2-head [ i386 ]
System Ruby
   system [ i386 ]

The ASCII arrow indicates which environment is currently enabled. In this case, it is Ruby 1.8.7. This could be confirmed by running:

$ ruby --version
ruby 1.8.7 (2010-01-10 patchlevel 249) [i686-linux]

Switching Environment

To switch from one environment, to another simply run:

$ rvm <version/environment>

For example to switch to Ruby 1.8.7 one would run the following command:

$ rvm 1.8.7

It can be confirmed by running:

$ ruby --version
ruby 1.8.7 (2010-01-10 patchlevel 249) [i686-linux]


Ruby 1.8.x won't compile with RVM

This is a known issue on Arch Linux, and is caused by a problem with openssl. The [Ruby1.8 package in the AUR](http://aur.archlinux.org/packages.php?ID=30221) has solved this issue with a patch included in the package. Simply [download the package from AUR](http://aur.archlinux.org/packages.php?ID=30221), download Ruby 1.8.7 source, apply the patch contained in the package, archive it the patched source to a tar.gz file, and put this file into ~/.rvm/archives/ruby.1.8.7-p249.tar.gz. Try to install Ruby 1.8.7 via RVM again, and it should use the patched source, and work.