Apple announced Xcode 4.3 for OSX Lion and 4.4 for OSX Mountain Lion last week. The major difference is that Xcode no longer provide an installer which is good thing because you now could update Xcode with AppStore in the future, plus it is much easier to carry the development environment with you. However, there is a little problem with this new version of Xcode, is that all command line toolsets and compilers are not visible in terminal.
這段話說的是新版的Xcode已經改成直接拖動到Application里邊而不是以前的必須一步步安裝:好處是方便,壞處是gcc/g++等命令都識別不了了。
解決辦法:
1.自己將這些命令添加到環境變量:
export PATH=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:$PATH Please be noted that clang does not reside in /Developer/usr/bin, it is now in /Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin Now you could access to gcc, g++, git or any toolsets bundled with Xcode. For your convenience, it is recommended to include it in your .bash_profile.
2.最簡單不過了,安裝Xcode命令行工具:寫本文是已經是Xcode 5了:在Preference里邊有Downloads可以下載,如果沒有下載,可以到www.apple.com-->支持,按名稱搜索:CommandLine工具、命令行工具,下載安裝即可。