问题描述
我已更新到macOS Mojave(这也发生在Catalina更新中).
I updated to macOS Mojave (this happens to Catalina update too).
今天早上,我在MacBook Pro上的命令行中导航至工作的代码库,在存储库中键入"git status",并收到错误消息:
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
推荐答案
问题是需要更新Xcode命令行工具.
The problem is that Xcode Command-line Tools needs to be updated.
返回您的终端并点击:
xcode-select --install
您将收到:
xcode-select: note: install requested for command line developer tools
此时将在窗口中提示您更新Xcode命令行工具. (可能需要一段时间)
You will be prompted at this point 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.
添加:对于任何主要或半主要更新,您都需要更新命令行工具,以使它们再次正常运行.检查Xcode是否有任何更新.这超出了莫哈韦沙漠...
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...
之后,重新启动终端
这篇关于macOS更新后Git无法正常运行(xcrun:错误:无效的活动开发人员路径(/Library/Developer/CommandLineTools)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!