如何更新Xcode命令行工具? [英] How to update Xcode Command Line Tools?
问题描述
我正在尝试在Mac OS X上更新命令行工具.
I am trying to update Command line tools on my mac osx.
~ softwareupdate --list
Software Update Tool
Copyright 2002-2015 Apple Inc.
Finding available software
Software Update found the following new or updated software:
* Command Line Tools (macOS El Capitan version 10.11) for Xcode-8.2
Command Line Tools (macOS El Capitan version 10.11) for Xcode (8.2), 150374K [recommended]
* iTunesX-12.5.5
iTunes (12.5.5), 263476K [recommended]
但是当我运行更新命令时,出现此错误:
But when I run the update command, I get this error:
softwareupdate -i Command Line Tools (macOS El Capitan version 10.11) for Xcode-8.2
zsh: number expected
这也不起作用:
softwareupdate -i Command Line Tools
Software Update Tool
Copyright 2002-2015 Apple Inc.
Command: No such update
Line: No such update
Tools: No such update
No updates are available.
我应该在sofwareupdate -i?
推荐答案
对于将来的旅行者,这是与版本无关的方法.首先,运行softwareupdate --list
.这可能需要几分钟.完成后,您将看到如下所示的项目符号(带有星号)输出:
For future travelers, here's a version-agnostic approach. First, run softwareupdate --list
. This will probably take a couple of minutes. When it's done, you'll see a bulleted (with an asterisk) output like this:
$ softwareupdate --list
Software Update Tool
Finding available software
Software Update found the following new or updated software:
* Command Line Tools (macOS High Sierra version 10.13) for Xcode-10.1
Command Line Tools (macOS High Sierra version 10.13) for Xcode (10.1), 190584K [recommended]
找到引用Xcode命令行工具的项目符号.复制该行(星号除外).在上述情况下,您将复制:Command Line Tools (macOS High Sierra version 10.13) for Xcode-10.1
Find the bullet that refers to the Xcode command line tools. Copy that entire line (except the asterisk...). In the above case, you would copy: Command Line Tools (macOS High Sierra version 10.13) for Xcode-10.1
然后,使用您在引号内复制的内容运行安装命令(如Brendan Shanks所示):
Then, run the install command (as shown by Brendan Shanks) with what you copied inside quotes:
softwareupdate -i "Command Line Tools (macOS High Sierra version 10.13) for Xcode-10.1"
这篇关于如何更新Xcode命令行工具?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!