English follows Japanese.
以下のコンテンツは新規情報がみつかる度に書き換えられます。
xcode 4.3 から Commandline tools とか色々と分離されたらしい。
ちょうど同じタイミングで Mac Ports とか HomeBrew とか更新したお陰で半日潰すハメになったよ。。
とりあえず本体は Appstore からで、他は Developer site とか、紛らわしいから止めて欲しいのだが、リリースノート読まない俺が悪いのか。。Apple Developer Account 持ってる人は AppStore からインストールしないほうがいい気がするぞ。
とりあえず分かったこと。
Xcode 4.3
- Xcode.app は Application 本体と各種ツール群を分離
- その結果、アプリケーションの実体のインストール先がこれまでの /Developers から /Applications/Xcode.app/Contents/Developer になった
- ついでに Apple のポリシー的に、これまでの gcc はインストールされなくなった。代わりに互換性の為の llvm-gcc が含まれている。
- /usr/bin 以下の各種開発ツール群(のリンク)も、 .app 単体には含まれず、一見消えたようにみえる
- だが Apple Developer Site から Coomand Line Tools for Xcode を別途インストールすると、/usr/bin からリンクが作成される
- Developer Site に行かなくても、次の手順でインストールできるらしい。 “Xcode > Preferences > Downloads > Components > Command Line Tools”
- xcode-select -print-pathしても、Path が設定されていない
xcode-select: Error: No Xcode folder is set. Run xcode-select -switch <xcode_folder_path> to set the path to the Xcode folder. - しゃーないから以下のコマンドを手打ちしたほうがよさげ
xcode-select –switch /Applications/Xcode.app/Contents/Developer - $PATH に /Applications/Xcode.app/Contents/Developer/usr/bin を加える必要は無い、代わりに Coomand Line Tools をインストールするだけでよい。
MacPorts
今現在 MacPorts 側でも対応中の部分がありますが、port install がこける場合はとりあえず以下を試してみたらいいようです。
sudo port clean hoge sudo port install hoge configure.compiler=llvm-gcc-4.2 // コピペミスを訂正しました
それでも駄目なら apple-gcc42 を使う。
sudo port clean hoge sudo port install apple-gcc42 sudo port install hoge configure.compiler=apple-gcc-4.2 configure.cxx=g++-apple-4.2
参考
- Migrating a MacPorts install: new OS, Xcode or CPU architecture https://trac.macports.org/wiki/Migration
- MacPorts stops working after installing Xcode 4.3 https://trac.macports.org/wiki/ProblemHotlist?version=73
HomeBrew
同じ理由で HomeBrew でもコンパイルがこけるかもしれない。その場合はやはり同様に llvm-gcc を指定してやれば良い。
brew --use-llvm install hoge
参考
- Support for Xcode 4.3 https://github.com/mxcl/homebrew/issues/9179
—
Xcode4.3, MacPorts, and HomeBrew
Xcode 4.3
- Xcode now installs itself to /Applications/Xcode.app
- And binaries are installed to /Applications/Xcode.app/Contents/Developer, formerly /Developers
- gcc is not included in Xcode 4.3, instead llvm-gcc is installed for compatibility
- Xcode 4.3 alone does not create nor install dev tools in /usr/bin
- There are separate dev tools provided at Apple developer site
- Or you can even install tools from “Xcode > Preferences > Downloads > Components > Command Line Tools”
- Installing Command Line Tools for Xcode would create links to tools at /usr/bin
- xcode-select -print-path does not return anything
- setting the path by running
$ xcode-select –switch /Applications/Xcode.app/Contents/Developer
would solve many of issues. - you do not need to add /Applications/Xcode.app/Contents/Developer/usr/bin to your $PATH, instead simply install Coomand Line Tools
MacPorts
Xcode 4.2 and later
If a port foo fails to build and you’re using Xcode 4.2 or later, the default compiler is clang; try compiling with llvm-gcc-4.2 instead:
sudo port clean foo sudo port install foo configure.compiler=llvm-gcc-4.2If that fails, try installing the apple-gcc42 port and compiling with that:
sudo port clean foo sudo port install apple-gcc42 sudo port install foo configure.compiler=apple-gcc-4.2 configure.cxx=g++-apple-4.2
Reference
- Migrating a MacPorts install: new OS, Xcode or CPU architecture https://trac.macports.org/wiki/Migration
- MacPorts stops working after installing Xcode 4.3 https://trac.macports.org/wiki/ProblemHotlist?version=73
HomeBrew
If you fails to compile with brew, you need to specify the use of llmv-gcc as below.
brew --use-llvm install foo
Reference
- Support for Xcode 4.3 https://github.com/mxcl/homebrew/issues/9179
の指定方法がわからなかったので助かりました。ありがとーございます!
昨晩作業をしていたらハマった上に、Twitter や Blog 探したらまだ出たばかりのバージョンで英語の情報ですら錯綜していたようなので、急いで書きました。少しでもお役に立てたのであれば良かったです 🙂
Pingback: Mac OS X LionでRails開発環境構築 | やぶろぐ – ooyabuh.org -
Pingback: Lionをクリーンインストールしたらhomebrewでどハマりした話-T&T
Pingback: Xcodeが4.3になったのでxcode-selectのファルダパスを変更しよう | CaCi - Takahiro's Kitchen
Pingback: sabi 庵 - web engineering -