如何从命令行更新 Xcode [英] How to update Xcode from command line

查看:57
本文介绍了如何从命令行更新 Xcode的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试从命令行更新 Xcode.最初我尝试运行:

I am trying to update Xcode from the command line. Initially I tried running:

 xcode-select --install

导致此消息:

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

那么问题仍然存在,有没有办法从命令行更新 Xcode?

So the question remains, is there a way to update Xcode from the command line?

推荐答案

您实际使用的是安装 Xcode 命令行工具的命令 - xcode-select --install.因此,您收到错误消息 - 工具已安装.

What you are actually using is the command to install the Xcode command line tools - xcode-select --install. Hence the error message you got - the tools are already installed.

你需要更新Xcode的命令是softwareupdate command [args ...].您可以使用 softwareupdate --list 查看可用的内容,然后使用 softwareupdate --install -a 安装所有更新或 softwareupdate --install 只安装 Xcode 更新(如果可用).您可以从 list 命令中获取名称.

The command you need to update Xcode is softwareupdate command [args ...]. You can use softwareupdate --list to see what's available and then softwareupdate --install -a to install all updates or softwareupdate --install <product name> to install just the Xcode update (if available). You can get the name from the list command.

正如评论中提到的那样这里是男人softwareupdate 工具的页面.

As it was mentioned in the comments here is the man page for the softwareupdate tool.

2019 年更新

许多用户遇到的问题是softwareupdate --install -a实际上不会更新到最新版本的>Xcode.造成这种情况的原因很可能是一个未决的 ma​​cOS 更新(正如@brianlmerritt 在下面指出的那样).在大多数情况下,首先更新 ma​​cOS 将解决问题,并允许更新 Xcode.

A lot of users are experiencing problems where softwareupdate --install -a will in fact not update to the newest version of Xcode. The cause for this is more than likely a pending macOS update (as @brianlmerritt pointed out below). In most cases updating macOS first will solve the problem and allow Xcode to be updated as well.

更新 Xcode 命令行工具

很大一部分用户登陆这个答案是为了更新 Xcode 命令行工具.实现此目的的最简单方法是删除旧版本的工具,然后安装新版本.

A large portion of users are landing on this answer in an attempt to update the Xcode Command Line Tools. The easiest way to achieve this is by removing the old version of the tools, and installing the new one.

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

将出现一个弹出窗口并指导您完成其余的过程.

A popup will appear and guide you through the rest of the process.

这篇关于如何从命令行更新 Xcode的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆