brewの設定


目次

  • zshインストール
  • gitインストール
  • rbenv

zshインストール

別記事 参照

gitインストール

初期状態
$ git --version

git version 1.9.3 (Apple Git-50)
インストール
zsh
$ brew install git 
パスをとおす
$ brew doctor
‥
‥
Warning: /usr/bin occurs before /usr/local/bin

This means that system-provided programs will be used instead of those

provided by Homebrew. The following tools exist at both paths:

    git

    git-cvsserver

    git-receive-pack

    git-shell

    git-upload-archive

    git-upload-pack
‥
‥
$ echo 'export PATH="/usr/local/bin:$PATH"' >> ~/.zshrc
$ source ~/.zshrc

$ brew unlink git && brew link git

Unlinking /usr/local/Cellar/git/2.4.2... 223 symlinks removed
Linking /usr/local/Cellar/git/2.4.2... 209 symlinks created
確認

$ git --version

git version 2.4.2

rbenvインストール

最新のrubyをいれるためにrbenvインストール
$ brew update
$ brew install rbenv ruby-build readline
.zshrc

# for rbenv 
if which rbenv > /dev/null; then eval "$(rbenv init - zsh)"; fi

最新の安定版をチェック
https://www.ruby-lang.org/ja/downloads/

# インストールできるバーション一覧を確認
$ rbenv install --list

# インストール
$ rbenv install 2.2.2

まだインストールされただけで
インストールしたバージョンに切り替わったわけじゃない

現在のバージョン確認
$ ruby -v
ruby 2.0.0p481 (2014-05-08 revision 45883) [universal.x86_64-darwin14]
バーションを切り替え 
$ rbenv global 2.2.2
バーション確認
$ ruby -v
ruby 2.2.2p95 (2015-04-13 revision 50295) [x86_64-darwin14]

railsインストール

$ gem install bundler
$ gem install rails
$ rbenv rehash

確認

$ rails -v
Rails 4.2.2

参考
http://tsuchikazu.net/mac_rail_setup/