首页 > 解决方案 > 在安装 pod 期间,我收到此错误

问题描述

无法从中提取 git 版本git --version。相反,我看到:

xcrun: error: active developer path ("/Users/mcbook/Downloads/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.

标签: xcode

解决方案


与所有 macOS 应用程序一样,Xcode 应用程序在文件系统中表示为一个文件夹,即使在 Finder 中我们将其视为一个图标。

在 Xcode 的例子中,它的主 app 文件夹包含子目录,其中包含一些命令行开发工具,这些工具在安装需要编译的应用程序时是必需的。

当你第一次运行 Xcode 时,它​​会为你注册这个子文件夹的位置。不幸的是,看起来你第一次运行 Xcode 时它还在你的Downloads文件夹中,所以你所有的命令行工具仍在那里寻找它。

我假设在此期间您已经将 Xcode(正如您所期望的那样,它也将所有应用程序文件夹的文件和子文件夹也移动到了您的/Applications文件夹中)。

您应该能够使用以下命令行命令重定向所有工具以查看新的正确位置:

sudo xcode-select -s /Applications/Xcode.app/Contents/Developer

推荐阅读