简体   繁体   English

Git 在 macOS 更新后不工作(xcrun:错误:无效的活动开发人员路径(/Library/Developer/CommandLineTools)

[英]Git is not working after macOS Update (xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools)

I updated to the latest OS, and/or restarted my computer (this happens on every major update, but this time all I did was restart my computer on 2022-09-13)我更新到最新的操作系统,和/或重新启动了我的计算机(每次重大更新都会发生这种情况,但这次我所做的只是在 2022-09-13 重新启动我的计算机)

This morning I navigated to my work's codebase in the Command Line on my MacBook pro, typed in "git status" in the repository and received an error:今天早上,我在 MacBook pro 的命令行中导航到我工作的代码库,在存储库中输入“git status”并收到错误消息:

(IN 9/2022, this error was much different, but I didn't capture it) (在 9/2022 中,这个错误有很大的不同,但我没有捕捉到它)

xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun xcrun:错误:无效的活动开发人员路径 (/Library/Developer/CommandLineTools),缺少 xcrun 位于:/Library/Developer/CommandLineTools/usr/bin/xcrun

git will not work! git 不行!

How do I fix git, and command line tools?如何修复 git 和命令行工具?

The problem is that Xcode Command-line Tools needs to be updated.问题是需要更新 Xcode 命令行工具。

Solution #1解决方案#1

Go back to your terminal and enter:返回您的终端并输入:

xcode-select --install

You'll then receive the following output:然后,您将收到以下输出:

xcode-select: note: install requested for command line developer tools

You will then be prompted in a window to update Xcode Command Line tools.然后将在一个窗口中提示您更新 Xcode 命令行工具。 (which may take a while) (可能需要一段时间)

Open a new terminal window and your development tools should be returned.打开一个新的终端窗口,您的开发工具应该会返回。

Addition: With any major or semi-major update you'll need to update the command line tools in order to get them functioning properly again.另外:对于任何主要或半主要更新,您都需要更新命令行工具以使它们再次正常运行。 Check Xcode with any update.检查 Xcode 是否有任何更新。 This goes beyond Mojave...这超越了莫哈韦...

After that restart your terminal之后重新启动您的终端

Alternatively, IF that fails, and it very well might.... you'll get a pop-up box saying "Software not found on server", see below!或者,如果失败,它很可能......你会得到一个弹出框,上面写着“在服务器上找不到软件”,见下文!

Solution #2解决方案#2

and you hit xcode-select --install and it doesn't find the software, log into Apple Developer, and install it via webpage.然后你点击xcode-select --install并没有找到该软件,登录到 Apple Developer,然后通过网页安装它。

Log in or sign up here:在此处登录或注册:

https://developer.apple.com/download/more/ https://developer.apple.com/download/more/

Look for: "Command Line Tools for Xcode 12.x" in the list of downloads Then click the dmg and download.在下载列表中查找: “Xcode 12.x 的命令行工具”然后单击 dmg 并下载。

苹果开发者页面的图像和 DL 的 dmg

I got some errors that the software was unavailable from the update server when trying我在尝试时收到一些错误,即更新服务器上的软件不可用

xcode-select --install

What fixed it for me was going here https://developer.apple.com/download/more/ and downloading Command Line Tools (macOS 10.14) for Xcode 10 and then installing it manually.为我解决的问题是去这里https://developer.apple.com/download/more/并下载Command Line Tools (macOS 10.14) for Xcode 10 ,然后手动安装。

After that, the errors should be gone when you open up a new terminal.之后,当您打开一个新终端时,错误应该消失了。

对我来说xcode-select --reset是 Mojave 的解决方案。

除了dustbuster的回答之外,我还需要使用以下命令设置 Xcode 文件夹的路径:

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

updated from Mojave to Big Sur and got the same error : the command从 Mojave 更新到 Big Sur 并得到相同的错误:命令

xcode-select --install

worked like a charm像魅力一样工作

For me what worked is the following:对我来说有效的是:

sudo xcode-select --reset

Then like in @High6's answer:然后就像@High6 的回答一样:

sudo xcodebuild -license

This will reveal a license which I assume is some Xcode license.这将显示一个我认为是一些 Xcode 许可证的许可证。 Scroll to the bottom using space (or the mouse) then tap agree .使用空格(或鼠标)滚动到底部,然后点击agree

This is what worked for me on MacOS Mojave v 10.14.这就是在 MacOS Mojave v 10.14 上对我有用的方法。

After upgrade to Mac Catalina I faced the same issue, I had to run couple of commands to get this fixed.升级到 Mac Catalina后,我遇到了同样的问题,我不得不运行几个命令来解决这个问题。

First started with:首先开始于:

xcode-select --install

It didn't fix the problem, had to run the following in sudo它没有解决问题,必须在sudo中运行以下命令

sudo xcode-select --reset

Then, finally got fixed after I switched and set the path explicitly for active developer directory:然后,在我切换并明确设置活动开发者目录的路径后,终于得到了修复:

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

Note: In case you have Xcode installed, you may need to specify Xcode directory in this case, it should be something like this注意:如果您安装了Xcode ,在这种情况下您可能需要指定Xcode目录,它应该是这样的

xcode-select -s /Applications/Xcode.app

I've used xcode-select --install given in the accepted answer in previous major releases.我已经使用xcode-select --install在以前的主要版本中接受的答案中给出。

I've just upgraded to OS X 10.15 Catalina and run the Software Update tool from preferences again after the OS upgrade completed.我刚刚升级到 OS X 10.15 Catalina 并在操作系统升级完成后再次从首选项运行软件更新工具。 The Xcode utilities update was available there, which also sorted the issue using git which had just output xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools) Xcode 实用程序更新在那里可用,它还使用刚刚输出xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools)

in my case it wasn't checked in xcode After installation process ,在我的情况下,它没有在安装过程之后在 xcode 中检查,

you can do that as following : xcode -> Preferences and tap Locations then select , as the followng image你可以这样做:xcode -> Preferences 并点击 Locations 然后选择,如下图

在此处输入图像描述

If you use xcode then install it (~12GB)如果你使用xcode然后安装它(~12GB)

xcode-select --install

Otherwise install latest command line tools (~500MB)否则安装最新的命令行工具(~500MB)

下载

Mac OS : Big Sur Mac OS :大苏尔

First Priority首要任务

sudo xcode-select --reset

sudo xcodebuild -license

Second Priority第二优先

xcode-select --install

I figured out the Xcode Command Line Tools part from the error message, but after running Xcode and getting the prompt to install the additional tools it did claim to install them, but still I got the same error after opening a new terminal.我从错误消息中找出了 Xcode 命令行工具部分,但是在运行 Xcode 并获得安装附加工具的提示后,它确实声称要安装它们,但在打开新终端后仍然出现相同的错误。

So I did the xcode-select --install manually and after that it worked for me.所以我手动做了xcode-select --install ,然后它对我有用。

Following worked on M1以下工作于 M1

ProductName:    macOS
ProductVersion: 11.2.1
BuildVersion:   20D74

% xcode-select --install

Agree the Terms and Conditions prompt, it will return following message on success.同意条款和条件提示,成功后将返回以下消息。

% xcode-select: note: install requested for command line developer tools

If you have Xcode downloaded manually (ie not from the App Store) or don't have Xcode at all:如果您手动下载了 Xcode(即不是从 App Store 下载的)或根本没有 Xcode:

  1. sudo rm -rf /Library/Developer/CommandLineTools
  2. Go to https://developer.apple.com/download/more/ to download Command Line Tools (macOS 10.14) for Xcode 10前往https://developer.apple.com/download/more/下载 Xcode 10 的命令行工具 (macOS 10.14)
  3. Setup Command Line Tools设置命令行工具

If you have Xcode installed from the App Store:如果您从 App Store 安装了 Xcode:

  1. xcode-select --install

Open Terminal:打开终端:

install XCode developer tools and fix the problem.安装 XCode 开发者工具并修复问题。

$ xcode-select --install

Reset the path to Xcode if you have several versions:如果您有多个版本,请重置 Xcode 的路径:

$ xcode-select --switch /Applications/Xcode.app
$ xcode-select --switch /Library/Developer/CommandLineTools
  1. Run this command:运行此命令:

xcode-select --install xcode-选择--安装

  1. Hit return for a progress indicator on the Command Line Tools download.点击返回以获得命令行工具下载的进度指示器。

  2. After installation of the Command Line Tools has been completed, your Mac should be rebooted.命令行工具安装完成后,您的 Mac 应该会重新启动。 If you're getting “xcrun error invalid active developer path” while working in Terminal, refresh the application or relaunch it.如果您在终端中工作时收到“xcrun error invalid active developer path”,请刷新应用程序或重新启动它。

Even after following the above-mentioned steps, if you see the error: invalid active developer path (/Library/Developer/CommandLineTools).即使按照上述步骤操作,如果您看到错误:无效的活动开发者路径 (/Library/Developer/CommandLineTools)。 The next step would be to try and install Command Line Tools using a DMG file that can be downloaded directly from the Apple website.下一步是尝试使用可以直接从 Apple 网站下载的 DMG 文件安装命令行工具。

Again, if you are using Homebrew, you need to update it.同样,如果您使用的是 Homebrew,则需要对其进行更新。 You don't need to uninstall and again install Homebrew on Mac .您无需在 Mac 上卸载并重新安装 Homebrew

NOTE: If you are using Homebrew, try updating it after re-installing Command Line tools.注意:如果您使用 Homebrew,请在重新安装命令行工具后尝试更新它。

Credits: Git not working after macOS Update致谢: macOS 更新后 Git 无法正常工作

I updated to macOS Mojave (this happens on Catalina update too, and seems to potentially occur on every major update thereafter)我已更新到macOS Mojave(这也在Catalina更新中发生,并且似乎在以后的每个主要更新中都可能发生)

This morning I navigated to my work's codebase in the Command Line on my MacBook pro, typed in "git status" in the repository and received the error:今天早上,我在MacBook Pro上的命令行中导航到工作的代码库,在存储库中输入“ git status”,并收到错误消息:

xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun xcrun:错误:无效的活动开发人员路径(/ Library / Developer / CommandLineTools),缺少xcrun,位于:/ Library / Developer / CommandLineTools / usr / bin / xcrun

How do I fix git, and command line tools?如何修复git和命令行工具?

I updated to macOS Mojave (this happens on Catalina update too, and seems to potentially occur on every major update thereafter)我已更新到macOS Mojave(这也在Catalina更新中发生,并且似乎在以后的每个主要更新中都可能发生)

This morning I navigated to my work's codebase in the Command Line on my MacBook pro, typed in "git status" in the repository and received the error:今天早上,我在MacBook Pro上的命令行中导航到工作的代码库,在存储库中输入“ git status”,并收到错误消息:

xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun xcrun:错误:无效的活动开发人员路径(/ Library / Developer / CommandLineTools),缺少xcrun,位于:/ Library / Developer / CommandLineTools / usr / bin / xcrun

How do I fix git, and command line tools?如何修复git和命令行工具?

I updated to macOS Mojave (this happens on Catalina update too, and seems to potentially occur on every major update thereafter)我已更新到macOS Mojave(这也在Catalina更新中发生,并且似乎在以后的每个主要更新中都可能发生)

This morning I navigated to my work's codebase in the Command Line on my MacBook pro, typed in "git status" in the repository and received the error:今天早上,我在MacBook Pro上的命令行中导航到工作的代码库,在存储库中输入“ git status”,并收到错误消息:

xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun xcrun:错误:无效的活动开发人员路径(/ Library / Developer / CommandLineTools),缺少xcrun,位于:/ Library / Developer / CommandLineTools / usr / bin / xcrun

How do I fix git, and command line tools?如何修复git和命令行工具?

This just happened to me after upgrading my Macbook pro to macOS Ventura.在将我的 Macbook pro 升级到 macOS Ventura 后,这发生在我身上。 After the upgrade, the git command line stopped working with showing up this message.升级后,git 命令行停止工作并显示此消息。

xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun xcrun:错误:无效的活动开发人员路径 (/Library/Developer/CommandLineTools),缺少 xcrun 位于:/Library/Developer/CommandLineTools/usr/bin/xcrun

Running brew upgrade fixed git command line.运行brew upgrade修复了 git 命令行。

For me, I didn't have xcode installed (on Mojave OS).对我来说,我没有安装 xcode(在 Mojave OS 上)。 I went to the App Store on my mac and downloaded it, then went back to terminal and typed git and hit enter, then it worked.我在我的 Mac 上去 App Store 并下载了它,然后回到终端并输入git并回车,然后它就可以工作了。

I found that my version of Xcode was too outdated and installing command-line-tools wasn't helping.我发现我的 Xcode 版本太过时了,安装命令行工具没有帮助。 Here's what I did:这是我所做的:

  • I completely uninstalled the outdated XCode我完全卸载了过时的 XCode
  • I reinstalled the most recent XCode from the app store我从应用商店重新安装了最新的 XCode
  • That was all.就这些。 Git was restored. Git 已恢复。

This works for me这对我有用

sudo xcode-select --reset 
sudo xcodebuild -license

X-code must be installed.必须安装 X-code。

I observed in the Catalina privacy setting if Xcode not added in Full access disk I will get the same error, Xcode does not run scripts.我在 Catalina 隐私设置中观察到,如果 Xcode 没有添加到完全访问磁盘中,我会得到同样的错误,Xcode 不运行脚本。 Add your Xcode the same as in the attached image.添加您的 Xcode,与所附图像中的相同。 After that clean build and run.在干净的构建和运行之后。 Hope so it will work.希望它会起作用。 安全与隐私

For me, for the macos Ventura 13.0 user installing this software helped对我来说,对于安装此软件的 macOS Ventura 13.0 用户有帮助在此处输入图像描述

I wasn't able to run any xcode install commands, git was not working at all.我无法运行任何xcode安装命令,git 根本无法运行。

You can find this package here https://developer.apple.com/download/all/你可以在这里找到这个包https://developer.apple.com/download/all/

对于那些使用 Catalina 和 Xcode-beta 的用户:

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

I updated to macOS Mojave (this happens on Catalina update too, and seems to potentially occur on every major update thereafter)我已更新到macOS Mojave(这也在Catalina更新中发生,并且似乎在以后的每个主要更新中都可能发生)

This morning I navigated to my work's codebase in the Command Line on my MacBook pro, typed in "git status" in the repository and received the error:今天早上,我在MacBook Pro上的命令行中导航到工作的代码库,在存储库中输入“ git status”,并收到错误消息:

xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun xcrun:错误:无效的活动开发人员路径(/ Library / Developer / CommandLineTools),缺少xcrun,位于:/ Library / Developer / CommandLineTools / usr / bin / xcrun

How do I fix git, and command line tools?如何修复git和命令行工具?

For me It happened after Mac OS update to Mojave and git was not functioning in Intellij对我来说它发生在 Mac OS 更新到 Mojave 并且 git 在 Intellij 中无法运行之后

Solution:- Go to Settings, then File |解决方案:- 转到设置,然后转到文件 | Settings |设置 | Version Control |版本控制 | Git and edit Path to Git executable field which is /usr/local/bin/git Git 并编辑 Git 可执行字段的路径,即 /usr/local/bin/git

I had the same issue and couldn't use SVN after the update,我有同样的问题,更新后无法使用SVN

Just in case if doing xcode-select --install didn't fix the issue,以防万一执行xcode-select --install没有解决问题,

You might see,你可能会看到,

svn: error: The subversion command line tools are no longer provided by Xcode. svn:错误:Xcode 不再提供 subversion 命令行工具。

Refer : https://developer.apple.com/documentation/macos_release_notes/macos_catalina_10_15_release_notes参考: https ://developer.apple.com/documentation/macos_release_notes/macos_catalina_10_15_release_notes

Try installing the svn by brew尝试通过brew安装 svn

brew install svn

This should get you going.这应该让你继续前进。

I updated my macOS yesterday,from macOS Mojave(10.14.6)to macOS Catalina(10.15.7),I was executing "git" command in my project.我昨天更新了我的macOS,从macOS Mojave(10.14.6)到macOS Catalina(10.15.7),我在我的项目中执行“git”命令。 I get same errors。我得到同样的错误。

run:跑:

xcode-select --install

After Updating macOS to Monterey (12.3) from BigSur getting such issueBigSur将 macOS 更新到Monterey (12.3) 后遇到此类问题

only worked-只工作-

xcode-select --install xcode-选择--安装

Done!完毕!

MacOS :Monterey MacOS:蒙特雷
Year: 2022年份:2022

Solution: Upgrade to 12.2.1 or later解决方案:升级到 12.2.1 或更高版本

I upgraded to Monetery 12.2 as my Macbook pro got replaced.更换 Macbook pro 后,我升级到了 Monetery 12.2。 Ran into same issue as OP:遇到与OP相同的问题:

Git is not working after macOS Update (Xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools)

One would think that by this time Apple would have added xCode & developer tools into OS main build.有人会认为,到这个时候,Apple 会在 OS 主构建中添加 xCode 和开发人员工具。 Turned out they did.结果他们做到了。 I had to upgrade to 12.2.1, which included " command line tools for xCode ".我不得不升级到 12.2.1,其中包括“ xCode 命令行工具”。
I still need to do step upgrade to 12.4 , but I believe we finally have these tools as part of OS build.我仍然需要逐步升级到 12.4 ,但我相信我们最终将这些工具作为操作系统构建的一部分。

Here's screen-shot while attempting to upgrade from 12.2.1 to 12.3.1 (I forgot to take one while upgrading from 12.2 to 12.2.1, but I am pretty sure it had same Addons)这是尝试从 12.2.1 升级到 12.3.1 时的屏幕截图(我在从 12.2 升级到 12.2.1 时忘记拍一张,但我很确定它有相同的插件)

在此处输入图像描述

如果您在外部驱动器中创建了一个新的 Applications 文件夹并在那里安装了 Xcode:

sudo xcode-select --switch /Volumes/MyExternalStorageName/Applications/Xcode.app/Contents/Developer

Edge case, but still worth writing down: when migrating from and older Mac with Migration Assistant, you may have selected the option to transfer all your applications from your older Mac.边缘案例,但仍然值得写下:使用迁移助手从旧版 Mac 迁移时,您可能选择了从旧版 Mac 迁移所有应用程序的选项。 Applications, like Xcode needs to be updated if it was transferred and preserved OR delete from your other user's Applications folder.如果 Xcode 之类的应用程序从您的其他用户的应用程序文件夹中传输并保留或删除,则需要对其进行更新。 This is because Xcode has not been set up properly after the first start with the new OS version.这是因为 Xcode 在第一次启动新的 OS 版本后没有正确设置。

As of September 13, 2022, I had a similar issue after upgrading my MBP M1 to Monterey 12.6, and although I followed some of the answers, my Mac kept prompting me with a dialogue to install git as a developer tool.截至 2022 年 9 月 13 日,我在将 MBP M1 升级到 Monterey 12.6 后遇到了类似的问题,尽管我遵循了一些答案,但我的 Mac 一直提示我安装git作为开发人员工具的对话框。 Every time that the installation was completed, I was prompted to the same dialogue.每次安装完成时,都会提示我进行相同的对话。

Finally, I had to do a combination of all the answers to make it work:最后,我必须结合所有答案才能使其工作:

  1. First remove the command line tool:首先删除命令行工具:
sudo rm -rf /Library/Developer/CommandLineTools
  1. Reinstall the xcode-select :重新安装xcode-select
xcode-select --install

The above will prompt you with a dialogue to confirm the installation.上面会提示你一个对话框来确认安装。

  1. Set path to the Xcode folder with following:使用以下命令设置 Xcode 文件夹的路径:
sudo xcode-select -switch /Library/Developer/CommandLineTools

I had this same issue after updating to macOS 13 Ventura.更新到 macOS 13 Ventura 后,我遇到了同样的问题。

Command: xcode-select also does not seem work.命令: xcode-select似乎也不起作用。 so does sudo xcodebuild . sudo xcodebuild也是如此。

After checking the xcode itself it install the command line tools and the said command still fails to work.检查xcode本身后,它安装了命令行工具,但上述命令仍然无法正常工作。

在此处输入图像描述

After checking this part it appears to be blank.检查这部分后,它似乎是空白的。 I just manually set it to use the available command line from the installed xcode and everything now works including git .我只是手动将其设置为使用已安装的 xcode 中的可用命令行,现在一切正常,包括git

For Ventura 13.0.1.对于文图拉 13.0.1。

Update for macOS Ventura 13.0.1 (Nov 2022) Install Command Line Tools for Xcode 14.1 macOS Ventura 13.0.1 更新(2022 年 11 月) 为 Xcode 14.1 安装命令行工具

it's worked for me它对我有用

I updated to macOS Mojave (this happens on Catalina update too, and seems to potentially occur on every major update thereafter)我已更新到macOS Mojave(这也在Catalina更新中发生,并且似乎在以后的每个主要更新中都可能发生)

This morning I navigated to my work's codebase in the Command Line on my MacBook pro, typed in "git status" in the repository and received the error:今天早上,我在MacBook Pro上的命令行中导航到工作的代码库,在存储库中输入“ git status”,并收到错误消息:

xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun xcrun:错误:无效的活动开发人员路径(/ Library / Developer / CommandLineTools),缺少xcrun,位于:/ Library / Developer / CommandLineTools / usr / bin / xcrun

How do I fix git, and command line tools?如何修复git和命令行工具?

I updated to macOS Mojave (this happens on Catalina update too, and seems to potentially occur on every major update thereafter)我已更新到macOS Mojave(这也在Catalina更新中发生,并且似乎在以后的每个主要更新中都可能发生)

This morning I navigated to my work's codebase in the Command Line on my MacBook pro, typed in "git status" in the repository and received the error:今天早上,我在MacBook Pro上的命令行中导航到工作的代码库,在存储库中输入“ git status”,并收到错误消息:

xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun xcrun:错误:无效的活动开发人员路径(/ Library / Developer / CommandLineTools),缺少xcrun,位于:/ Library / Developer / CommandLineTools / usr / bin / xcrun

How do I fix git, and command line tools?如何修复git和命令行工具?

Even I was facing the same issue when I upgraded my mac from MacOS BigSur to macOS Monterey .甚至当我将我的 mac 从MacOS BigSur升级到macOS Monterey时,我也面临着同样的问题。

Running the below command, resolved the above issue ✅运行下面的命令,解决了上面的问题✅

$ xcode-select --install

None of the above answers worked for me.以上答案都不适合我。 I had a couple of issues.我有几个问题。 First, I installed the latest version of Xcode , 14.0 beta .首先,我安装了最新版本Xcode 14.0 beta That ended up not working because it was a version that is not compatible with Monterey .最终不起作用,因为它是一个与Monterey不兼容版本 And my computer is too old to install Ventura beta .而且我的电脑太旧,无法安装Ventura beta So I had to go and find out which version of Xcode actually did work.所以我不得不去找出哪个版本的 Xcode 确实有效。 And that ended up being 13.4.1 .最后是13.4.1 So I installed that.所以我安装了那个。 I had taken all the right steps beforehand to delete the old version, and then placed the new one, as always, into my Applications folder.我事先已经采取了所有正确的步骤来删除旧版本,然后像往常一样将新版本放入我的应用程序文件夹中。 But for whatever reason, it did not end up there.但无论出于何种原因,它并没有结束。 When I checked to see if my install was successful , errors were thrown in Terminal .当我检查我的安装是否成功时,终端出现错误 I had also previously updated CLT , which included the correct version .之前更新CLT ,其中包括正确的版本 However, Terminal returned that I needed to install CLT .但是,终端返回需要安装CLT And when I tried , it told me that it was already installed , but I should change the path of my Xcode or install CLT (which obviously was not a real option ).尝试时,它告诉我它已经安装了,但我应该更改我的 Xcode 的路径安装CLT (这显然不是一个真正的选择)。 I found the solution in this article entitled Xcode-select active developer directory error .我在这篇题为Xcode-select active developer directory error 的文章中找到解决方案 And I ran the following command in Terminal which fixed my path :我在终端运行以下命令修复了我的路径

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

Hope this helps anyone else who encounters the same issue when trying to update Xcode on macOS Monterey and also can't update to macOS Ventura.希望这对尝试在 macOS Monterey 上更新 Xcode 并且也无法更新到 macOS Ventura 时遇到相同问题的其他人有所帮助。

With previous app development experience, may I say with confidence that the git version delivered with apple always create problems.以以往的app开发经验,可以肯定地说,苹果自带的git版本总是出问题。 So the sooner you get rid of apple git the better, so may I suggest:所以越早摆脱苹果 git 越好,所以我可以建议:

brew uninstall git
brew update
brew install git

# which git
/usr/local/bin/git

Try running Xcode on a mac.尝试在 Mac 上运行 Xcode。 I installed XCode but never launched it.我安装了 XCode 但从未启动它。 When starting XCode installed the utilities.启动 XCode 时安装了实用程序。

For Ventura 13.1对于文图拉 13.1

I updated from macOS BigSur to Ventura 13.1 (Jan 2023).我从 macOS BigSur 更新到 Ventura 13.1(2023 年 1 月)。 I only installed Xcode on the apple store and it worked for me.我只在苹果商店安装了 Xcode,它对我有用。 在此处输入图像描述

I updated to macOS Mojave (this happens on Catalina update too, and seems to potentially occur on every major update thereafter)我已更新到macOS Mojave(这也在Catalina更新中发生,并且似乎在以后的每个主要更新中都可能发生)

This morning I navigated to my work's codebase in the Command Line on my MacBook pro, typed in "git status" in the repository and received the error:今天早上,我在MacBook Pro上的命令行中导航到工作的代码库,在存储库中输入“ git status”,并收到错误消息:

xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun xcrun:错误:无效的活动开发人员路径(/ Library / Developer / CommandLineTools),缺少xcrun,位于:/ Library / Developer / CommandLineTools / usr / bin / xcrun

How do I fix git, and command line tools?如何修复git和命令行工具?

为我工作 xcode-select --install

faced same issue after updating from bigSur to Monterey从 bigSur 更新到 Monterey 后面临同样的问题

xcode-select --install

this worked for me.这对我有用。

For macOS ventura Just re-install git its work for me对于 macOS ventura 只需为我重新安装 git 它的工作

暂无
暂无

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

相关问题 当运行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”) xcrun:错误:活动开发者路径(“/Applications/Xcode.app/Contents/Developer”)不存在 - xcrun: error: active developer path ("/Applications/Xcode.app/Contents/Developer") does not exist 升级到 El Capitan 后无效的活动开发者路径错误 - Invalid active developer path error after upgrading to El Capitan “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? 更改 xcrun 开发人员路径 - change xcrun developer path 工具“xcodebuild”需要 Xcode,但活动开发者目录“/Library/Developer/CommandLineTools”是命令行工具实例 - tool 'xcodebuild' requires Xcode, but active developer directory '/Library/Developer/CommandLineTools' is a command line tools instance xcrun:错误:无法找到实用程序“ Validation”,而不是开发人员工具或在PATH中 - xcrun: error: unable to find utility “Validation”, not a developer tool or in PATH xcrun:错误:无法找到实用程序“xctest”,不是开发人员工具或 PATH - xcrun: error: unable to find utility "xctest", not a developer tool or in PATH 安装 Ruby 后 MAC OS X 上的活动开发者路径无效 - Invalid active developer path on MAC OS X after installing Ruby
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM