简体   繁体   English

“xcrun: error: active developer path ... does not exist, use xcode-select --switch” 试图运行 git 时。如何修复?

[英]"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

Try this below answer.试试下面的答案。 It's worked for me.它对我有用。

Open your Xcode Preferences ,打开您的 Xcode首选项

--> Select Locations --> Select地点

--> Select your specific Xcode version in Command Line Tools --> Select 您在命令行工具中的特定 Xcode 版本

在此处输入图像描述

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安装的所有软件。

  1. To install brew, open a terminal window and run:要安装 brew,请打开终端窗口并运行:

     ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
  2. Update your brew packages with brew update使用brew update更新您的 brew 包

  3. Install git with 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 打开它。

聚光灯下的 xcode

And open preferences:并打开首选项:

在此处输入图片说明

And select my Command Line Tools under "Locations".并在“位置”下选择我的命令行工具。

在此处输入图片说明

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 xcrun:错误:活动开发者路径(“/Applications/Xcode.app/Contents/Developer”)不存在 - xcrun: error: active developer path ("/Applications/Xcode.app/Contents/Developer") does not exist xcode-select active developer directory 错误 - xcode-select active developer directory error 如何使用'xcode-select'为Qt安装设置活动的开发人员目录? - How to set active developer directory with ‘xcode-select’ for Qt installation? 使用 cli 工具包时的 xcode-select -switch 路径 - xcode-select -switch path when using cli toolkit 当运行git status时,Mojave更新后发生以下错误:“ xcrun:错误:无效的活动开发人员路径” - When running git status the following error happens after Mojave update: “xcrun: error: invalid active developer path” 奇怪的错误消息:xcode-select:错误:格式错误的开发人员路径(“/Library/Developer/CommandLineTools”) - Strange error message : xcode-select: error: malformed developer path (“/Library/Developer/CommandLineTools”) Git 在 macOS 更新后不工作(xcrun:错误:无效的活动开发人员路径(/Library/Developer/CommandLineTools) - Git is not working after macOS Update (xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools) 我用什么设置xcode-select -switch? - What do setting do I use for xcode-select -switch? 如何用xcode-select选择XCode 3.2.6? - How to select XCode 3.2.6 with xcode-select? 活动开发者路径 (\"/Applications/Xcode10.1.app/Contents/Developer\") 不存在 - Active developer path (\"/Applications/Xcode10.1.app/Contents/Developer\") does not exist
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM