我正在尝试从命令行更新Xcode。一开始我试着跑步:

 xcode-select --install

这就产生了这条信息:

xcode-select: error: command line tools are already installed, use "Software Update" to install updates

那么问题来了,有没有办法从命令行更新Xcode呢?


当前回答

对于那些在更新到卡特琳娜后有此问题的人,只需在您的终端上执行此命令

sudo rm -rf /Library/Developer/CommandLineTools; xcode-select --install;

其他回答

$ sudo rm -rf /Library/Developer/CommandLineTools
$ xcode-select --install

对于那些在更新到卡特琳娜后有此问题的人,只需在您的终端上执行此命令

sudo rm -rf /Library/Developer/CommandLineTools; xcode-select --install;

你好,我是这样解决的:

安装应用程序> Xcode。>内容>资源>包> XcodeSystemResources.pkg。

我在删除Xcode后得到这个错误。我通过使用sudo xcode-select -r重置命令行工具路径来修复它。

之前:

navin@Radiant ~$ /usr/bin/clang
xcrun: error: active developer path ("/Applications/Xcode.app/Contents/Developer") does not exist
Use `sudo xcode-select --switch path/to/Xcode.app` to specify the Xcode that you wish to use for command line developer tools, or use `xcode-select --install` to install the standalone command line developer tools.
See `man xcode-select` for more details.

navin@Radiant ~$ xcode-select --install
xcode-select: error: command line tools are already installed, use "Software Update" to install updates

后:

navin@Radiant ~$ /usr/bin/clang
clang: error: no input files

这提醒了我为什么讨厌MacOS。每次我尝试这些错误之一,我都会得到一个无法理解的错误:无法请求安装(可能没有UI存在) 事实证明,这个“CLI”实际上需要一个图形会话才能运行。WTF !当你只通过SSH连接到远程mac服务器来排队iOS构建时,这非常有用。

所以我的答案是:

物理移动到Mac上,安装屏幕、鼠标和键盘,然后在那里运行命令。