Ryusuke Fuda's Tech Blog

Softweare Enginier about Web, iOS, Android.

Ruby install Mac

MacRubyインストール

■ まず、Ruby Version Manager(RVM)をインストールする

$ curl -sSL https://get.rvm.io | bash -s stable
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/{USERNAME}/.bash_profile':

      source ~/.profile

ワーニングが出た

$ echo 'source ~/.profile' >> ~/.bash_profile
$ source ~/.bash_profile
$ curl -sSL https://get.rvm.io | bash -s stable

ワーニング消えた。

Rubyインストール

最新バージョン確認してインストール

$ rvm list known ruby
$ sudo rvm install ruby-2.1.1 --default

最新バージョンへ切り替え

$ ruby -v
ruby 2.0.0p247 (2013-06-27 revision 41674) [universal.x86_64-darwin13]
$ rvm list

rvm rubies

 * ruby-2.1.1 [ x86_64 ]

# => - current
# =* - current && default
#  * - default
$ rvm  use 2.1.1
Using /Users/{USERNAME}/.rvm/gems/ruby-2.1.1
$ ruby -v
ruby 2.1.1p76 (2014-02-24 revision 45161) [x86_64-darwin12.0]

これでインストール完了

RVM ではなくrbenvでいれる場合

■ rbenvインストール

$ brew install rbenv ruby-build

■ インストールできるバージョン一覧

$ rbenv install -l

■ バージョン指定しインストール

$ rbenv install 2.1.2

■ インストールしたバージョン確認

$ ruby -v


参考)
http://d.hatena.ne.jp/takeR/20140301/1393670527
http://tsuchikazu.net/mac_rail_setup/
http://qiita.com/ongaeshi/items/b07beebca21ba7ed8e7f