我更新了最新的操作系统,和/或重新启动了我的计算机(每次重大更新都会发生这种情况,但这次我所做的只是在2022-09-13年重新启动我的计算机)

今天早上,我在MacBook pro的命令行中导航到我的工作代码库,在存储库中键入“gitstatus”,收到一个错误:

(2022年9月,这个错误大不相同,但我没有捕捉到它)

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

git不起作用!

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


当前回答

这对我有用

sudo xcode-select --reset 
sudo xcodebuild -license

必须安装X代码。

其他回答

M1的后续工作

ProductName:    macOS
ProductVersion: 11.2.1
BuildVersion:   20D74

% xcode-select --install

同意“条款和条件”提示,成功后将返回以下消息。

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

对于Ventura 13.0.1。

macOS Ventura 13.0.1更新(2022年11月)为Xcode 14.1安装命令行工具

这对我有用

在BigSur将macOS更新到Monterey(12.3)后,出现了这样的问题

只工作过-

xcode select--安装

完成!

对我来说,我没有安装xcode(在Mojave OS上)。我去了我的mac上的应用商店,下载了它,然后回到终端,输入git并点击enter,然后它就工作了。

对我来说,对于macos Ventura 13.0用户,安装此软件有助于

我无法运行任何xcode安装命令,git根本无法工作。

你可以在这里找到这个包裹https://developer.apple.com/download/all/