最近我在macOS上首次安装了Qt 5.5,并使用Qt Creator开发。然而每次启动或打开项目时,都会遇到以下错误提示:
Project ERROR: Xcode not set up properly. You may need to confirm the license agreement by running /usr/bin/xcodebuild.
然后当我在终端执行 /usr/bin/xcodebuild
时,会得到如下错误信息:
xcode-select: error: tool 'xcodebuild' requires Xcode, but active developer directory '/Library/Developer/CommandLineTools' is a command line tools instance
经过调研和尝试,找到了几种解决方案,这里整理一下供大家参考。
解决方案
1. 配置xcode-select
当你安装了完整的Xcode之后(而不仅仅是命令行工具),你需要指向正确的开发者目录并接受许可协议:
sudo xcode-select -switch /Applications/Xcode.app/Contents/Developer
sudo xcodebuild -license
接受许可协议后再次尝试打开Qt Creator项目,看是否解决了问题。<