MacOS系统升级到Big Sur后CMake报xcode-select错误的解决办法

昨晚把MacBook的系统从10.15升级到了Big Sur 11.2.3,结果原先的CMake工程编译时出现错误,大致如下:

-- The CXX compiler identification is unknown
-- The C compiler identification is unknown
......略
xcode-select: error: tool 'xcodebuild' requires Xcode, but active developer directory '/Library/Developer/CommandLineTools' is a command line tools instance

搜索了一下,大概原因是系统升级时修改了某些系统参数,运行如下命令即可解决:

sudo xcode-select -s /Applications/Xcode.app/Contents/Developer

运行该命令的前提条件:已经安装了Xcode,并且Xcode.app在/Applications目录下。

问题解决,做个记录。

你可能感兴趣的:(开发技术,C++,Cmake,mac,os,x)