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

 xcode-select --install

这就产生了这条信息:

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

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


当前回答

我遇到了同样的问题,使用下面的命令解决了它。

sudo xcode-select -s /Library/Developer/CommandLineTools

运行上述命令后,xcode-select -p命令显示如下内容。

/图书馆/开发/ 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。>内容>资源>包> XcodeSystemResources.pkg。

我不知道为什么这对我来说如此棘手。

sudo xcode-select --install

什么也没为我做。

softwareupdate --all --install --force

什么也没为我做。

我必须按照下面的顺序做事

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

这安装了一个更新的xcode,但不是最新的。

然后我做了

softwareupdate --all --install --force

他们完全更新了。

我在删除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

Xcode::Install是一个简单的命令行软件,允许你安装/选择特定的Xcode版本。

您可以使用gem install xcode-install安装它 然后,您将能够使用xcversion install 9.4.1安装特定的版本 如果您安装了多个版本,则可以使用xcversion select 9.4切换版本

你可以在https://github.com/KrauseFx/xcode-install上找到更多信息