Git在MacOS Catalina上不起作用:“ xcrun:错误:无效的活动开发人员路径(/ Library / Developer / CommandLineTools),缺少”

168 git macos bash zsh macos-catalina

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

现在,默认的交互式外壳为zsh。

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

有关更多详细信息,请访问https://support.apple.com/kb/HT208050

〜| 吉特

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

我以为我的外壳有问题,所以我按照说明使用GUI和命令行使用了将默认Mac OS外壳改回bash的方法:

chsh -s /bin/bash
Run Code Online (Sandbox Code Playgroud)

我还重新启动了计算机。但是,即使echo "$SHELL"输出,我仍然看到相同的消息/bin/bash

nay*_*hev 274

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

$ xcode-select --install
Run Code Online (Sandbox Code Playgroud)

  • 有效!另外,将`export BASH_SILENCE_DEPRECATION_WARNING = 1`添加到您的〜/ .bash_profile`文件中,以消除烦人的消息。 (16认同)
  • xcode-select --reset是我设备的解决方案。 (14认同)
  • 认真学习此命令。升级macOS后,几乎总是解决开发问题的方法。 (12认同)
  • sudo xcode-select --reset工作正常。但是,它还需要同意条款和条件。该命令是:sudo xcodebuild -license (3认同)