[Mac] homebrew が最新の Xcode でうごかない場合の対処

最近 TMux、のPowerline が使用したくてやってみようと思ったら brew が動かなくなっていました。これはXCodeのコマンドラインツールが最近のXcodeに含まれなくなったためでした。 Homebrew は動かないと色々診断してくれるので便利ですね。
とはいえ、大分前の Xcode 4.5位からの話だとの事でずっと使っていなかったから発生しているだけであまり該当する人は少ないかと思います。最近の導入手順には書いていますしね。 ( [Mac] Mountain Lionへパッケージ管理「Homebrew」をインストールする手順のメモ | Tools 4 Hack )

古いXcodeのままだとこんなエラーが出ます。


Error: Failed executing: make prefix=/usr/local/Cellar/git/1.7.10.1 CC=/usr/bin/xcrun\ clang CFLAGS=-Os\ -w\ -pipe\ -march=native\ -Qunused-arguments LDFLAGS= install (git.rb:49)
If `brew doctor' does not help diagnose the issue, please report the bug:
https://github.com/mxcl/homebrew/wiki/reporting-bugs

こんな感じに `brew doctor` してみなって言われますので実際に実行してみると

Error: You have no /usr/bin/cc.
This means you probably can't build *anything*. You need to install the Command
Line Tools for Xcode. You can either download this from http://connect.apple.com
or install them from inside Xcode's Download preferences. Homebrew does not
require all of Xcode! You only need the Command Line Tools package!
Error: Git could not be found in your PATH.
Homebrew uses Git for several internal functions, and some formulae use Git
checkouts instead of stable tarballs. You may want to install Git:
brew install git
Error: /usr/X11 is a symlink
Homebrew's X11 support has only be tested with Apple's X11.
In particular, "XQuartz" and "XDarwin" are not known to be compatible.
sh: git: command not found
Error: Your Homebrew is outdated
You haven't updated for at least 24 hours, this is a long time in brewland!

っていくつか言われています。最初のやつはXCodeのコマンドライン版が入っていないという事です。こちらに関しては最近のXcodeから似なりますが簡単に入れる事が出来ます。Xcodeを起動して「Preference」-> 「Download」で「Command line tools」があるのでこちらを「Install」すれば自動的に入ります。

スクリーンショット 2012 11 19 0 13 2

らくちんですね。再度 `brew doctor`してみましょう。


Error: /usr/X11 is a symlink
Homebrew's X11 support has only be tested with Apple's X11.
In particular, "XQuartz" and "XDarwin" are not known to be compatible.
Error: Your Homebrew is outdated
You haven't updated for at least 24 hours, this is a long time in brewland!

という感じになりました。アップデートしてねと言われているのでアップデートすると色々パッケージが入ります。その後も doctor のお世話になりながら進めていくとエラーが消えるところまで行けます。

ようやくこれで使用できるようになりました。

参考
・ Lion へアップグレードしたら Homebrew が動かなくなったりもしたけれど、私はげんきです – 彼女からは、おいちゃんと呼ばれています


コメントを残す

Created by roguer.info 2016