Mojave最新解決方案:
終端執行:
xcode-select --install
#完成后執行
sudo installer -pkg /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg -target /
若執行 xcode-select --install 出現錯誤:
xcode-select: error: command line tools are already installed, use "Software Update" to install updates
解決辦法:
$ rm -rf /Library/Developer/CommandLineTools
$ xcode-select --install
如果提示權限不夠那么加上sudo