脳汁portal

アメリカ在住(だった)新米エンジニアがその日学んだIT知識を書き綴るブログ

[Ruby]RVMのリストを更新する方法

RVMのリストをupdateする方法

RVMをupdateして、`rvm list known`で表示されるinstall可能なパッケージを増やす方法
最新のversionを入れたい場合など。

コマンド

最初にコマンドだけご紹介

$ rvm get stable
$ rvm install #{インストールしたいversion}

説明

一つ一つ説明していきます

現状
$ rvm -v
rvm 1.25.33 (latest) by Wayne E. Seguin <wayneeseguin@gmail.com>, Michal Papis <mpapis@gmail.com> [https://rvm.io/]

$ rvm list known
・
・
[ruby-]2.0.0-p481
[ruby-]2.0.0[-p576]
[ruby-]2.1.2
[ruby-]2.1[.3]
[ruby-]2.1-head
ruby-head
・
・

現在はruby 2.1.3までしかダウンロードできません

リストの更新
$ rvm get stable

Downloading https://get.rvm.io
Downloading https://github.com/rvm/rvm/archive/1.26.11.tar.gz
Downloading https://github.com/rvm/rvm/releases/download/1.26.11/1.26.11.tar.gz.asc
gpg: Signature made Tue 31 Mar 2015 06:52:13 AM JST using RSA key ID BF04FF17
gpg: Good signature from "Michal Papis (RVM signing) <mpapis@gmail.com>"
gpg: WARNING: This key is not certified with a trusted signature!
gpg:          There is no indication that the signature belongs to the owner.
Primary key fingerprint: 409B 6B17 96C2 7546 2A17  0311 3804 BB82 D39D C0E3
     Subkey fingerprint: 62C9 E5F4 DA30 0D94 AC36  166B E206 C29F BF04 FF17
GPG verified '/usr/local/rvm/archives/rvm-1.26.11.tgz'

Upgrading the RVM installation in /usr/local/rvm/
Upgrade of RVM in /usr/local/rvm/ is complete.

# User,
#
#   Thank you for using RVM!
#   We sincerely hope that RVM helps to make your life easier and more enjoyable!!!
#
# ~Wayne, Michal & team.

In case of problems: http://rvm.io/help and https://twitter.com/rvm_io

Upgrade Notes:

  * No new notes to display.

RVM reloaded!

`rvm update stable`は古いコマンドなので、最近のRVMでは動かないっぽい

確認
$ rvm -v
rvm 1.26.11 (latest) by Wayne E. Seguin <wayneeseguin@gmail.com>, Michal Papis <mpapis@gmail.com> [https://rvm.io/]

$ rvm list known
・
・
[ruby-]2.1.4
[ruby-]2.1[.5]
[ruby-]2.2[.1]
[ruby-]2.2-head
ruby-head
・
・

RVMが最新にUpdateされて、リストの内容も新しくなりました

インストール

最新版のinstallを行います

$ rvm install 2.2.0
Searching for binary rubies, this might take some time.
No binary rubies available for: centos/6/x86_64/ruby-2.2.0.
Continuing with compilation. Please read 'rvm help mount' to get more information on binary rubies.
Checking requirements for centos.
Requirements installation successful.
Installing Ruby from source to: /usr/local/rvm/rubies/ruby-2.2.0, this may take a while depending on your cpu(s)...
ruby-2.2.0 - #downloading ruby-2.2.0, this may take a while depending on your connection...
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 12.6M  100 12.6M    0     0  1922k      0  0:00:06  0:00:06 --:--:-- 7479k
ruby-2.2.0 - #extracting ruby-2.2.0 to /usr/local/rvm/src/ruby-2.2.0....
ruby-2.2.0 - #applying patch /usr/local/rvm/patches/ruby/2.2.0/fix_installing_bundled_gems.patch.
ruby-2.2.0 - #configuring.........................................................
ruby-2.2.0 - #post-configuration..
ruby-2.2.0 - #compiling....................................................................................
ruby-2.2.0 - #installing............................
ruby-2.2.0 - #making binaries executable..
ruby-2.2.0 - #downloading rubygems-2.4.8
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  437k  100  437k    0     0  83412      0  0:00:05  0:00:05 --:--:-- 1256k
No checksum for downloaded archive, recording checksum in user configuration.
ruby-2.2.0 - #extracting rubygems-2.4.8....
ruby-2.2.0 - #removing old rubygems.........
ruby-2.2.0 - #installing rubygems-2.4.8......................
ruby-2.2.0 - #gemset created /usr/local/rvm/gems/ruby-2.2.0@global
ruby-2.2.0 - #importing gemset /usr/local/rvm/gemsets/global.gems...............................................
ruby-2.2.0 - #generating global wrappers........
ruby-2.2.0 - #gemset created /usr/local/rvm/gems/ruby-2.2.0
ruby-2.2.0 - #importing gemsetfile /usr/local/rvm/gemsets/default.gems evaluated to empty gem list
ruby-2.2.0 - #generating default wrappers........
ruby-2.2.0 - #adjusting #shebangs for (gem irb erb ri rdoc testrb rake).
Install of ruby-2.2.0 - #complete
Please be aware that you just installed a ruby that requires 1 patches just to be compiled on an up to date linux system.
This may have known and unaccounted for security vulnerabilities.
Please consider upgrading to ruby-2.2.1 which will have all of the latest security patches.
Ruby was built without documentation, to build it run: rvm docs generate-ri

$ rvm list
rvm rubies

 * ruby-2.1.2 [ x86_64 ]
=> ruby-2.2.0 [ x86_64 ]

# => - current
# =* - current && default
#  * - default

$ ruby -v
ruby 2.2.0p0 (2014-12-25 revision 49005) [x86_64-linux]


なお、RVMをupdateせずにリストだけupdateする方法は推奨されていないようです。stackoverflow.com