從App Store上下載的Xcode,默認是不會安裝Command Line Tools的,Command Line Tools是在Xcode中的一款工具,可以在命令行中運行C程序。
在終端中輸入命令
xcode-select --install
會彈出提示框
選擇同意協議
安裝中
安裝完成后,在終端中執行gcc -v命令查看是否安裝成功。
如果顯示如下內容,則按照成功。
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/usr/include/c++/4.2.1 Apple LLVM version 8.1.0 (clang-802.0.42) Target: x86_64-apple-darwin16.6.0 Thread model: posix InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin