[英]"xcrun: error: active developer path… does not exist, use xcode-select --switch" when trying to run git. How to fix?
I have been trying to instal the Git on my mac, But every time I use the command $git --version.我一直在尝试在我的 mac 上安装 Git,但每次我使用命令 $git --version。
I get the following error我收到以下错误
xcrun: error: active developer path ("/Volumes/Xcode/Xcode.app/Contents/Developer") does not exist, use xcode-select --switch path/to/Xcode.app
to specify the Xcode that you wish to use for command line developer tools (or see man xcode-select
) xcrun: error: active developer path ("/Volumes/Xcode/Xcode.app/Contents/Developer") 不存在,使用
xcode-select --switch path/to/Xcode.app
来指定你想使用的 Xcode对于命令行开发工具(或参见man xcode-select
)
I have already installed the Xcode on my mac for iOS App development.我已经在我的 mac 上安装了 Xcode 用于 iOS App 开发。 I am not sure what this error is trying to say.
我不确定这个错误想说什么。
So from discussion in the comments above, it seems the right fix here is just to run the command /usr/bin/xcode-select -switch
once (ie, run it with the full path to the executable, rather than just as xcode-select
) with /Applications/Xcode.app/Contents/Developer/
as the argument:因此,从上面评论中的讨论来看,这里的正确解决方法似乎只是运行命令
/usr/bin/xcode-select -switch
一次(即,使用可执行文件的完整路径运行它,而不是像xcode-select
) 与/Applications/Xcode.app/Contents/Developer/
作为参数:
sudo /usr/bin/xcode-select -switch /Applications/Xcode.app/Contents/Developer
After running that once, everything should work as expected from then on.运行一次后,从那时起一切都应该按预期工作。
My case:我的情况:
I removed XCode.我删除了 XCode。 JetBrains integration with git - breaks.
JetBrains 与 git 的集成 - 中断。 Found this error in terminal.
在终端中发现此错误。
My soltuion:我的解决方案:
I don't want to download XCode to restore PyCharm.我不想下载 XCode 来恢复 PyCharm。 So I ran:
所以我跑了:
sudo xcode-select --reset
sudo /usr/bin/xcode-select --switch /Library/Developer/CommandLineTools
并重新启动您的计算机。
You can install git
via the brew
package manager for Mac.您可以通过 Mac 的
brew
包管理器安装git
。 I recommend installing software this way since it's a great way to manage your installed packages in one place.我建议以这种方式安装软件,因为这是在一个地方管理已安装软件包的好方法。 For example, you can do
brew update
to get a list of the latest package updates, or brew upgrade
to upgrade all of your software installed through brew
.例如,您可以执行
brew update
以获取最新软件包更新的列表,或brew upgrade
以升级通过brew
安装的所有软件。
To install brew, open a terminal window and run:要安装 brew,请打开终端窗口并运行:
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
Update your brew packages with brew update
使用
brew update
更新您的 brew 包
brew install git
brew install git
I had installed git, then returned to a terminal window open prior to the installation.我已经安装了 git,然后返回到安装前打开的终端窗口。 I try running command
git --version
and this raised error message below.我尝试运行命令
git --version
并在下面引发错误消息。 To resolve, I ran command source /etc/profile
in same terminal window.为了解决这个问题,我在同一个终端窗口中运行了命令
source /etc/profile
。 BTW, terminal window is inside my Webstorm and my end goal is to git init
and setup git for my new reactjs project.顺便说一句,终端窗口在我的 Webstorm 中,我的最终目标是
git init
并为我的新 reactjs 项目设置 git。 Happy coding!快乐编码!
The error:错误:
xcrun: error: active developer path ("/Volumes/Xcode/Xcode.app/Contents/Developer") does not exist, use \`xcode-select --switch path/to/Xcode.app\` to specify the Xcode that you wish to use for command line developer tools (or see \`man xcode-select\`)
It was easier for me to let Xcode pick the install location of Command Line Tools for me, instead of the other way around.让 Xcode 为我选择命令行工具的安装位置对我来说更容易,而不是相反。 After downloading the
.xip
file from the Apple Developer downloads page, expanding the compressed contents, and installing Xcode.App, I was able to open it using Spotlight.从 Apple Developer 下载页面下载
.xip
文件、展开压缩内容并安装 Xcode.App 后,我可以使用 Spotlight 打开它。
And open preferences:并打开首选项:
And select my Command Line Tools under "Locations".并在“位置”下选择我的命令行工具。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.