macOS 更新后 Git 不工作(xcrun:错误:无效的活动开发者路径 (/Library/Developer/CommandLineTools) [英] Git is not working after macOS Update (xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools)

查看:30
本文介绍了macOS 更新后 Git 不工作(xcrun:错误:无效的活动开发者路径 (/Library/Developer/CommandLineTools)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我更新到了 macOS Mojave(这也发生在 Catalina 更新上,并且似乎可能发生在此后的每个重大更新中)

今天早上,我在 MacBook Pro 的命令行中导航到我工作的代码库,输入git status".在存储库中并收到错误:

<块引用>

xcrun:错误:无效的活动开发者路径 (/Library/Developer/CommandLineTools),缺少 xcrun 在:/Library/Developer/CommandLineTools/usr/bin/xcrun

如何修复 git 和命令行工具?

解决方案

问题是Xcode Command-line Tools需要更新.

解决方案#1

返回终端并输入:

xcode-select --install

然后您将收到以下输出:

xcode-select:注意:命令行开发工具要求安装

然后会在一个窗口中提示您更新 Xcode 命令行工具.(可能需要一段时间)

打开一个新的终端窗口,您的开发工具应该会返回.

补充:对于任何主要或半主要更新,您都需要更新命令行工具,以使它们再次正常运行.检查 Xcode 是否有任何更新.这超越了莫哈韦沙漠...

然后重启你的终端

或者,如果失败,而且很可能....您会看到一个弹出框,上面写着服务器上没有找到软件",见下文!

解决方案#2

然后你点击 xcode-select --install 并没有找到该软件,登录 Apple Developer,然后通过网页安装.

在此处登录或注册:

I updated to macOS Mojave (this happens on Catalina update too, and seems to potentially occur on every major update thereafter)

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:

xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun

How do I fix git, and command line tools?

解决方案

The problem is that Xcode Command-line Tools needs to be updated.

Solution #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. (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. 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

and you hit xcode-select --install and it doesn't find the software, log into Apple Developer, and install it via webpage.

Log in or sign up here:

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.

这篇关于macOS 更新后 Git 不工作(xcrun:错误:无效的活动开发者路径 (/Library/Developer/CommandLineTools)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆