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