我正在尝试从命令行更新Xcode。一开始我试着跑步:
xcode-select --install
这就产生了这条信息:
xcode-select: error: command line tools are already installed, use "Software Update" to install updates
那么问题来了,有没有办法从命令行更新Xcode呢?
我正在尝试从命令行更新Xcode。一开始我试着跑步:
xcode-select --install
这就产生了这条信息:
xcode-select: error: command line tools are already installed, use "Software Update" to install updates
那么问题来了,有没有办法从命令行更新Xcode呢?
当前回答
我是来安装Appium的。加上我的答案,以防其他人在这里遇到同样的问题。
ios appium-doctor——
... 一堆东西…
WARN AppiumDoctor 4运行xcrun simctl错误
... 一堆东西…
需要手动修复的问题
AppiumDoctor配置无法自动修复,请执行 第一:
警告AppiumDoctor➜手动安装Xcode,并确保“Xcode -select -p”命令显示正确的路径,如“/Applications/Xcode.app/Contents/Developer”
对我来说
xcode-select - p
/图书馆/开发/ CommandLineTools
这似乎是错误的……但我知道我最近更新了Xcode和命令行工具
所以…
Sudo xcode-select -r (Sudo必需)
然后……
xcode-select - p /应用程序/ xcode /内容/开发人员
在此之后,没有任何警告。阿普医生干净利落地回来了。
其他回答
我在删除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
我也遇到过同样的问题,我采取了以下方法:
删除旧的工具($ sudo rm -rf /Library/Developer/CommandLineTools) 重新安装xcode命令行工具($ xcode-select——Install)
完成这些步骤后,您将看到一个弹出窗口来安装新版本的工具。
当我卸载完整版本的Xcode以重新安装CLI版本时,我遇到了同样的问题。我的解决方案是:
sudo xcode-select -s /Library/Developer/CommandLineTools
在安装命令行工具(使用xcode-select——install)后,输入:
sudo xcode-select --switch /Library/Developer/CommandLineTools/
你现在应该可以运行git了:
10:29 $ git --version
git version 2.17.2 (Apple Git-113)
你实际使用的是安装Xcode命令行工具的命令Xcode -select——install。因此,您得到的错误消息-工具已经安装。
你需要更新Xcode的命令是softwareupdate command [args…]。你可以使用softwareupdate——list来查看可用的更新,然后使用softwareupdate——install -a来安装所有更新,或者使用softwareupdate——install <product name>来安装Xcode更新(如果可用)。您可以从list命令获取名称。
正如评论中提到的,这里是软件更新工具的手册页。
2019年更新
很多用户都遇到过这样的问题,softwareupdate——install -a实际上不会更新到最新版本的Xcode。造成这种情况的原因很可能是等待中的macOS更新(正如@brianlmerritt在下面指出的那样)。在大多数情况下,先更新macOS可以解决问题,同时也可以更新Xcode。
更新Xcode命令行工具
很大一部分用户是在尝试更新Xcode命令行工具时找到这个答案的。要实现这一点,最简单的方法是删除旧版本的工具,并安装新的工具。
sudo rm -rf /Library/Developer/CommandLineTools
xcode-select --install
将出现一个弹出窗口,并指导您完成其余的过程。