答案 0 :(得分:1)
在Mac上随时升级Xcode或操作系统时,似乎有可能删除命令行工具。
xcode-select --install
在终端窗口中,将安装工具,这也可以在xcode应用程序内完成。
[~] xcode-select -h
Usage: xcode-select [options]
Print or change the path to the active developer directory. This directory
controls which tools are used for the Xcode command line tools (for example,
xcodebuild) as well as the BSD development commands (such as cc and make).
Options:
-h, --help print this help message and exit
-p, --print-path print the path of the active developer directory
-s <path>, --switch <path> set the path for the active developer directory
--install open a dialog for installation of the command line developer tools
-v, --version print the xcode-select version
-r, --reset reset to the default command line tools path
如果您安装了多套工具(例如测试版),-s, --switch
标志也有助于将其指向您想要使用的工具(或者如果指向的版本已删除)