Installing Rubies
Official ruby interpreter releases that are supported by RVM can be installed using any of the below methods.
Known Rubies (Interpreters)
RVM maintains a list of interpreters and versions thereof to which it may install. In order to see this list run the following command.
$ rvm list known
Please note that RVM is not limited to simply this list.
Quick Install
Find the requirements (follow the instructions):
$ rvm requirementsInstall ruby:
$ rvm install 1.9.3You can also:
- watch the most accurate (but not official) rvm screencast,
- and try the official RVM GUI (OS X users only): Jewelry Box,
- starting with Rails? watch the RailsCasts.com on Getting Started with Rails
Patch Levels
Installing specific ruby patch levels (official releases)
Patch Levels with RVM
For each C-based interpreter, you can also specify a patchlevel using the '-l' or '--level' options. Each interpreter defaults to the latest patchlevel known to RVM. For example, RVM (as of this writing) defaults ruby 1.8.7 to patchlevel 352. If you wanted to switch to patchlevel 160 to test something out you can easily do that by:
$ rvm install ruby-1.8.7-p160 Installing Ruby from source to: ... $ ruby -v ruby 1.8.7 (2009-04-08 patchlevel 160) [i686-darwin9.8.0]
which will download, compile and install ruby-1.8.7-p160 and then set it to current. Switching between patchlevels is very easy:
$ rvm ruby-1.8.7-p160 Switching to ruby 1.8.7 160 ... $ ruby -v ruby 1.8.7 (2009-04-08 patchlevel 160) [i686-darwin9.8.0] $ rvm ruby-1.8.7-p352 Switching to ruby 1.8.7 174 ... $ ruby -v ruby 1.8.7 (2009-06-12 patchlevel 174) [i686-darwin9.8.0]
Don't forget about the shorthand due to defaults. The above is equivalent to
$ rvm 1.8.7-p160 # same as: rvm ruby-1.8.7-p160 $ rvm 1.8.7-p352 # same as: rvm ruby-1.8.7-p352
Repository Revisions (MRI)
Installing specific ruby repository revisions
Specifying repository revisions
Moving beyond official patch levels and tags we can also use any arbitrary revision for 1.8.X and 1.9.X
$ rvm install 1.8.6-r24700 ; rvm 1.8.6-r24700 $ ruby -v ruby 1.8.6 (2009-08-26 patchlevel 387) [i686-darwin10.0.0] $ which ruby /Users/wayne/.rvm/ruby-1.8.6-24700/bin/ruby
Tags (MRI)
Installing specific ruby tags
Repository Tags (MRI)
To install a specific tagged version of ruby from the repository we specify -t(tag name).
$ rvm install 1.8.6-tv1_8_6_111 ; rvm 1.8.6-tv1_8_6_111 $ which ruby /Users/wayne/.rvm/ruby-1.8.6-v1_8_6_111/bin/ruby
A list of all valid tags can be found in the ruby repository: http://svn.ruby-lang.org/repos/ruby/tags/
Branches (MRI)
Installing specific ruby branches
Repository Branches (MRI)
To install a specific branch version of ruby from the repository we specify --branch (branch name).
$ rvm install ruby-head --branch ruby_1_8 ; rvm ruby-head $ ruby -v ruby 1.8.8dev (2011-05-25) [i386-darwin10.7.0]
You'll find a list of all valid branches in the ruby repository: http://svn.ruby-lang.org/repos/ruby/branches/
Custom Patches (MRI)
Installing specific rubies with custom ruby source patches
$ rvm install 1.8.6 --patch /path/to/awesome.patch
Alternatively you can specify more than one patch; they are applied in the order given.
$ rvm install 1.8.6 --patch /path/to/awesome.patch,/path/to/another.patch
Getting the Latest and Greatest
You can get the head/trunk version of any given ruby as follows.
For any interpreter which has '-head' support, postfix '-head' after the interpreter name. For example, in order to install the latest development trunk for ruby 1.9.2:
$ rvm install ruby-1.9.2-head $ rvm use ruby-1.9.2-head
Install on Use
If you would like RVM to automatically install a ruby when you use it, add the following flag to your rvmrc file:
$ cat $HOME/.rvmrc rvm_install_on_use_flag=1
Configure flags
Configure script flags can be passed by a comma-separated list with no spaces after -C, like so:
$ rvm install 1.9.1 -C --enable-shared,--with-readline-dir=$HOME/.rvm/usr
Compile Flags
If you need to pass compile flags for the compile process, just set the corresponding environment variables.
As an example, to enable gdb for ruby 1.9.1:
$ export optflags="-O0 -ggdb" rvm install 1.9.1
Static MRI
If you wish to compile an MRI Ruby (1.8 / 1.9) as statically-linked instead of dynamically, then pass the --static flag like so:
$ rvm --static install 1.9.2