xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun
这是我在 VS Code 终端中收到的错误。“#include <stdio.h>”行下有错误曲线。
这是我升级到 Mac OS Monterey 后的情况。
出现这个错误的原因是什么以及解决办法是什么?
por*_*ors 10
升级 Mac 操作系统时,有时代码命令行工具会停止工作。可以通过在终端中运行以下命令来解决此问题:
sudo xcode-select --switch /Applications/Xcode.app/Contents/Developer
Run Code Online (Sandbox Code Playgroud)
如果你没有安装 Xcode,你应该这样做:
xcode-select --install
Run Code Online (Sandbox Code Playgroud)
这将在没有 Xcode 的情况下安装命令行工具。