RubyをMacにインストールする

rbenvでRubyをMacにインストールする

rbenv、ruby-buildセットアップ

$ brew update
$ brew install rbenv ruby-build
$ echo 'if which rbenv > /dev/null; then eval "$(rbenv init -)"; fi' >> ~/.bash_profile
$ source ~/.bash_profile

Rubyをインストール

インストール可能なバージョンを確認

$ rbenv install -l
  ...
  2.2.0-dev
  ...

インストール

$ rbenv install 2.1.2
$ rbenv rehash
$ rbenv global 2.1.2 # => ~/.rbenv/version にバージョンが記入される