bash Git 在 MacOS Catalina 上不起作用:“xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing”

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/58280652/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-08 22:39:14  来源:igfitidea点击:

Git doesn't work on MacOS Catalina: "xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing"

bashgitmacoszshmacos-catalina

提问by naydichev

After upgrading to MacOS X 10.15 Catalina, I cannot run any git commands in my shell:

升级到 MacOS X 10.15 Catalina 后,我无法在我的 shell 中运行任何 git 命令:

The default interactive shell is now zsh.

To update your account to use zsh, please run chsh -s /bin/zsh.

For more details, please visit https://support.apple.com/kb/HT208050.

~ | git

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

默认的交互式 shell 现在是 zsh。

要更新您的帐户以使用 zsh,请运行chsh -s /bin/zsh.

更多详情,请访问https://support.apple.com/kb/HT208050

~ | 混帐

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

I thought there's a problem with my shell, so I followed the instructions to change the default Mac OS shell back to bash, using the GUI and also using the command line:

我认为我的 shell 有问题,所以我按照说明将默认的 Mac OS shell 改回 bash,使用 GUI 并使用命令行:

chsh -s /bin/bash

I also restarted the computer. However, I still see the same message, even though echo "$SHELL"outputs /bin/bash.

我也重启了电脑。但是,我仍然看到相同的消息,即使echo "$SHELL"输出/bin/bash.

回答by naydichev

You'll need to reinstall the command line tools:

您需要重新安装命令行工具:

$ xcode-select --install