App Storeからxcodeをダウンロードしインストールする。インストール後一旦xcodeを起動しライセンスに同意する。
その後xcode-select --installを実行する
http://brew.sh/
$ /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
$ brew doctor
$ brew install git
$ brew install rbenv ruby-build
$ rbenv install -l
※最新版を選択
$ rbenv install 2.3.0
$ rbenv rehash
$ rbenv global 2.3.0
$ echo 'eval "$(rbenv init -)"' >> ~/.bash_profile
zshの場合
echo 'eval "$(rbenv init -)"' >> ~/.zshrc
シェルを再起動
$ brew install openssl
$ brew install readline
$ sudo gem install rails
シェルを再起動