2012年6月27日水曜日

brew doctorの /usr/bin occurs before /usr/local/binにはまったときの解決法

brew doctorするとはまる
以下エラーメッセージ


Error: /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:

    erb
    gem
    git
    git-cvsserver
    git-receive-pack
    git-shell
    git-upload-archive
    git-upload-pack
    gitk
    irb
    rake
    rdoc
    ri
    ruby
    testrb

Consider amending your PATH so that /usr/local/bin
is ahead of /usr/bin in your PATH.

なんどこの文字をみたことか。PATHおばけですw
$HOME内に.bash_profileが存在するのでこれを編集します。

export PATH="/usr/local/bin:$PATH:/usr/local/sbin"  (念のためコピペじゃなくて手打ちしてください。textの関係でうまく効かないかもしれないので)

でいったんターミナルを再起動(リブート)します。

立ち上げなおしたら、$ echo $PATH
をいれてみてください。
/usr/binの前に/usr/local/binが存在していることを確認できると思います。

参考:http://jokru.org/50451644


ちなみに、.bash_profileの場所が見つからないときは こちらを参照にしてください。
http://banker0507.blogspot.jp/2012/11/macbashprofile.html