mpapis, rys, ddd on IRC in
#rvm on irc.freenode.net
Official ruby interpreter releases that are supported by RVM can be installed using any of the below methods.
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.
Install ruby (follow the instructions):
rvm install 1.9.3You can also:
RVM allows two basic modes of operation interactive and non interactive. In interactive mode RVM is sourced as a function and is intended to interact with environment. In non interactive mode RVM is only added to PATH and can not interact with the environment. Because the interactive mode is intended mostly for use by users it also will display additional information and dialogs. To avoid this do not source rvm as a function or fallback to using binary with one of the following methods:
/full/path/to/rvm/bin/rvm install 1.9.3OR:
command rvm install 1.9.3
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
Installing specific ruby 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
Installing specific ruby tags
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/
Installing specific ruby branches
To install a specific branch version of ruby from the repository we specify --branch (branch name). Named rubies can help avoid clashes.
$ rvm install ruby-head -n zombie --branch ruby_1_8 && rvm ruby-head-zombie $ ruby -v ruby 1.8.8dev (2012-05-21) [i386-darwin10.8.0] $ rvm install ruby-head -n newborn && rvm ruby-head-newborn $ ruby -v ruby 2.0.0dev (2012-06-03 trunk 35876) [x86_64-darwin10.8.0]
You'll find a list of all valid branches in the ruby repository: http://svn.ruby-lang.org/repos/ruby/branches/
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
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
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 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
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
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
In order to conserve space, RVM does not automatically generate and install each Ruby's ri / rdoc documentation. To generate this documentation for Ruby please execute the following command:
$ rvm docs generate all
Please note that this requires the extracted source for the currently selected
Ruby version be on the system ($rvm_path/src/
Provided you have not cleaned up the extracted sources for all currently installed Rubies by executing 'rvm cleanup all' then you can install the docs for all currently installed Rubies by executing:
$ rvm all do rvm docs generate all
If you have executed a cleanup, unfortunately, this means to regenerate the documentation you would need to run, for example,:
$ rvm reinstall 1.9.3-p194 && rvm docs generate all
As always, don't forget to pass whatever additional parameters such as --patch to the reinstall portion of the command that you initially used, if any.
For more information, please see
$ rvm help docs