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

 xcode-select --install

这就产生了这条信息:

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

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


当前回答

xCode版本11.2.1对于在iPad 13.2.3中构建应用程序是必要的,当我直接尝试通过应用程序商店从xCode 11.1升级到11.2.1时,它被击中了,所以经过一些研究,我找到了一个解决方案,通过从系统中删除现有的xCode来升级

所以我在这里添加了卸载现有xcode后升级的步骤。

Go to Applications and identify Xcode and drag it to trash. Empty trash to permenently delete Xcode. Now go to ~/Library/Developer/ folder and remove the contents completely Use sudo rm -rf ~/Library/Developer/ to avoid any permission issue while deleting Lastly remove any cache directory associated with xcode in the path ~/Library/Caches/com.apple.dt.Xcode sudo rm -rf ~/Library/Caches/com.apple.dt.Xcode/* After completing the above steps you can easly install xcode from App Store, which will install the current latest version of xcode

注意:在进行上述更改之前,请备份现有项目

其他回答

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

所以我的答案是:

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

只要输入命令

cd  /Library/Developer/CommandLineTools/Packages/;
open macOS_SDK_headers_for_macOS_10.14.pkg

参考:https://forums.developer.apple.com/thread/104296

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

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

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

/图书馆/开发/ CommandLineTools

我是来安装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-select——install)后,输入:

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

你现在应该可以运行git了:

10:29 $ git --version
git version 2.17.2 (Apple Git-113)