brew update fails on Lion

Homebrewインストールメモ。

マシン:MacBookPro Snow LeopardをLionにアップデートした状態。

GitHub - Homebrew/legacy-homebrew: 💀 The former home of Homebrew/homebrew (deprecated) を参考にして

/usr/bin/ruby -e "$(curl -fsSL https://raw.github.com/gist/323731)"

簡単にインストールできました。

で、brewのupdateをしてみると、

brew update

error: unable to unlink old '.gitignore' (Permission denied)
error: unable to unlink old 'README.md' (Permission denied)
fatal: Could not reset index file to revision 'FETCH_HEAD'.
rm: .git: Permission denied
Error: Failure while executing: rm -rf .git 

何かがおかしい。
調べてみると、こんなページを発見。
brew update fails on new Hombrew install on Lion · Issue #6913 · Homebrew/legacy-homebrew · GitHub
Xcodeが原因のよう。

もう少し調べるとこんな記述が。
brew update fails 'unable to unlink old '.gitignore' · Issue #6886 · Homebrew/legacy-homebrew · GitHub
この通りにやってみる。

/usr/bin/ruby18 -e "$(curl -fsSL https://raw.github.com/gist/1140207)"

で、brewのupdateは

brew update

From http://github.com/mxcl/homebrew
 * branch            master     -> FETCH_HEAD
Already up-to-date.

ようやくできました。