更新macOS系统后,使用gcc/g++命令,提示错误xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools)

发布时间 2023-05-08 16:21:16作者: BooTurbo

 

 

更新macOS系统后,使用gcc/g++命令编译程序,提示错误xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun

解决方法:重新安装Command Line Tools,一般安装完成后问题就能修复,xcode-select --install,该命令并不会安装大型的Xcode

查看命令行工具版本

如果安装完命令行工具还是不行,可以运行:

sudo xcode-select --reset

 

 

 

注:现在macOS系统可以单独安装Command Line Tools了,不用再绑定Xcode。