RVM(Ruby Version Manager)をインストールしてみる。
$ curl -sSL https://get.rvm.io | bash -s stable
Downloading https://github.com/wayneeseguin/rvm/archive/stable.tar.gz
Installing RVM to /Users/xxxxxxx/.rvm/
Adding rvm PATH line to /Users/xxxxxxx/.profile /Users/xxxxxxx/.bashrc /Users/xxxxxxx/.zshrc.
Adding rvm loading line to /Users/xxxxxxx/.bash_profile /Users/xxxxxxx/.zlogin.
Installation of RVM in /Users/xxxxxxx/.rvm/ is almost complete:
* To start using RVM you need to run `source /Users/xxxxxxx/.rvm/scripts/rvm`
in all your open shell windows, in rare cases you need to reopen all shell windows.
# XXXXX ,
#
# 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
* WARNING: You have '~/.profile' file, you might want to load it,
to do that add the following line to '/Users/xxxxxxx/.bash_profile':
source ~/.profile
RVMのインストール後、警告が出たので
警告の内容としては、(分からないなりに意訳すると)
~/.profileファイルを持っているけど、それってロードしたいかもしれないんだよね。なので、'/Users/xxxxxxx/.bash_profile'へ、次の行を追記しておいてね。
source ~/.profile
ということで言われるがまま、.bash_profileへ追記した。追記したので、.bash_profileを再ロードしておく。
$ source ~/.bash_profile
いよいよRubyのインストール
インストールできるRubyの一覧を確認してみる。
$ rvm list known
# MRI Rubies
[ruby-]1.8.6[-p420]
[ruby-]1.8.7[-head] # security released on head
[ruby-]1.9.1[-p431]
[ruby-]1.9.2[-p330]
[ruby-]1.9.3[-p547]
[ruby-]2.0.0-p481
[ruby-]2.0.0[-p576]
[ruby-]2.1.2
[ruby-]2.1[.3]
[ruby-]2.1-head
ruby-head
・・・
この時点で、一番新しいのは 2.1 だったので、それをインストールしてみる。
Rubyのインストール
$ rvm install 2.1
新しくインストールしたRubyを使う
$ rvm use 2.1
動作状況を確認する。
$ ruby -v
ruby 2.1.3p242 (2014-09-19 revision 47630) [x86_64-darwin13.0]
$ which ruby
/Users/xxxxxxx/.rvm/rubies/ruby-2.1.3/bin/ruby
なお、ここの記事を参考にしました。