Installing Rubies

Official ruby interpreter releases that are supported by rvm can be installed using any of the below methods.

Patch Levels

Installing specific ruby patch levels (official releases)

Patch Levels with rvm

CRubyは-l–levelオプションを付けてパッチレベルを指定できる

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.

例えば、ruby 1.8.7の(これを書いている時点の)デフォルトパッチレベルは174になっている

For example, rvm (as of this writing) defaults ruby 1.8.7 to patchlevel 174.

パッチレベルを切り替えたい場合は下記のようにする。

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]

これで ruby-1.8.7-p160 がインストールされて使えるようになる。パッチレベルの切り替えはとても簡単にできる。

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-p174
 
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-p174    # same as: rvm ruby-1.8.7-p174

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

使わなそう…

Repository Tags (MRI)

-t(タグ名)オプションで、タグ付けされたrubyをインストールできる。

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

指定できるタグは http://svn.ruby-lang.org/repos/ruby/tags/ で見られる。

A list of all valid tags can be found in the ruby repository: http://svn.ruby-lang.org/repos/ruby/tags/

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 Head

Getting the head/trunk version of rubies is very simple. For any interpreter which has head support simply prefix -head after the interpreter. To get the latest development trunk for ruby:

∴ rvm install ruby-head
∴ rvm use ruby-head

Note that as of this writing 1.9.2 has no repository branch and thus "1.9.1-head" IS "1.9.2-head".

Install on Use

If you would like rvm to automatically install a ruby when you use it simply add the 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 you can simply 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
ruby/rvm/rubies/installing.txt · 最終更新: 2010/02/26 10:27 by fistfvck