Homebrew を アップデートしようとしたらハマった。

エラー発生

brew update で以下のエラーが出たので解決方法をメモ。

$ brew update
Checking out files: 100% (1184/1184), done.
Error: undefined method `to_sym' for nil:NilClass
Please report this bug:
    https://github.com/mxcl/homebrew/wiki/troubleshooting
/usr/local/Library/Homebrew/cmd/update.rb:134:in `report'
/usr/local/Library/Homebrew/cmd/update.rb:132:in `each_line'
/usr/local/Library/Homebrew/cmd/update.rb:132:in `report'
/usr/local/Library/Homebrew/cmd/update.rb:36:in `update'
/usr/local/Library/brew.rb:91:in `send'
/usr/local/Library/brew.rb:91

ひとまず brew doctor で状態確認。

$ brew doctor

XQuartz が古い

Warning: Your XQuartz (2.7.4) is outdated
Please install XQuartz 2.7.5:
  https://xquartz.macosforge.org

https://xquartz.macosforge.org から最新版の XQuartz をダウンロードしてインストール。

PATH がない

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:

    emacs
    emacsclient
    etags
    git
    git-cvsserver
    git-receive-pack
    git-shell
    git-upload-archive
    git-upload-pack
    gitk

Consider setting your PATH so that /usr/local/bin
occurs before /usr/bin. Here is a one-liner:
    echo export PATH='/usr/local/bin:$PATH' >> ~/.bash_profile

PATHを設定して、~/.bash_profile にも設定を追加しておく。

$ export PATH='/usr/local/bin:$PATH'
$ echo export PATH='/usr/local/bin:$PATH' >> ~/.bash_profile

無事解決

$ brew doctor
Your system is ready to brew.
$ brew update

brew doctor は問題なく、brew update も無事に完了出来ました。

参考

http://qiita.com/hshimo/items/e2ea3c21d8b150e3a055 http://bismar.hatenablog.com/entry/2012/12/06/022457

HomebrewMac