Mac OS X / XCodeをバージョンアップしたらhomebrewが動かなくなる問題への対策

ツール

tl;dr

https://github.com/Homebrew/homebrew/issues/50157

補足

Mac OSを10.11.4に更新し、同日App Storeに来ていたXCodeも更新してから、brew upgrade時に以下のようなエラーが出るようになりました。

$ brew upgrade
Error: Failure while executing: /usr/bin/otool -L /usr/bin/install_name_tool

brew updateやbrew doctorでは発生しません。また、XCodeも起動しなくなりました。 GitHubでis:issue is:open install_name_toolを検索したところ、#50091を見つけ、#50091にリンクしていた#50157を発見しました。

$ xcode-select --print-path
/Applications/Xcode.app/Contents/Developer

$ sudo xcode-select --switch /Library/Developer/CommandLineTools

これで、brew upgradeできるようになりました。