Skip to main content

macos 报错 missing xcrun

在macos上执行git命令, 报错missing xcrun, 印象里遇到好几次了

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

原因是macos每次更新版本, 都需要同意软件开发协议, 需要重新安装 command line devloper CommandLineTools

执行以下命令, 然后会弹出对话框, 进行下载.

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

下载完成问题解决, 并不需要安装xcode这种十几个GB的应用.

参考文档:

Why am I getting an “invalid active developer path” when attempting to use Git after upgrading to macOS Ventura?

https://apple.stackexchange.com/questions/254380/why-am-i-getting-an-invalid-active-developer-path-when-attempting-to-use-git-a

Open Terminal, and run the following:

xcode-select --install

This will pop a dialogue box, Select "Install", and it will download and install the Command Line Tools package and fix the problem. (The popped Window may be behind other windows.)

You do not need Xcode, you can install only the Command Line Tools here, it is about 130 MB (600 MB as of Xcode v14.1).

If the above alone doesn't do it, then also run:

sudo xcode-select --reset