Qt Creator - 项目错误:Xcode 设置不正确.您可能需要通过运行/usr/bin/xcodebuild 来确认许可协议
我刚刚安装了 Qt 5.5 并且第一次在 OS X 上使用 Qt Creator.当我第一次安装 Qt 时,它给了我一条错误消息Xcode 5 not installed",我认为这很奇怪,(我有 Xcode7 测试版),但安装还是成功完成.
I just installed Qt 5.5 and am using Qt Creator for the first time on OS X. When I first installed Qt, it gave me an error message 'Xcode 5 not installed' which I thought was strange, (I have the Xcode 7 beta), but the install completed successfully anyways.
现在,当我开始或打开一个项目时,出现错误:
Now, when I start or open a project, I get the error:
项目错误:Xcode 设置不正确.您可能需要通过运行/usr/bin/xcodebuild 来确认许可协议.
Project ERROR: Xcode not set up properly. You may need to confirm the license agreement by running /usr/bin/xcodebuild.
当我在终端中运行 /usr/bin/xcodebuild
时,我得到以下信息:
When I run /usr/bin/xcodebuild
in Terminal, I get the following:
xcode-select: 错误:工具 'xcodebuild' 需要 Xcode,但活动开发者目录 '/Library/Developer/CommandLineTools' 是命令行工具实例
xcode-select: error: tool 'xcodebuild' requires Xcode, but active developer directory '/Library/Developer/CommandLineTools' is a command line tools instance
我不确定 Xcode 与 Qt Creator 有什么关系,除非它与访问库以实现跨平台兼容性有关,但有没有办法解决这个问题?
I'm not sure what Xcode has to do with Qt Creator, unless it has something to do with accessing libraries for cross-platform compatibility, but is there a way to fix this issue?
推荐答案
>= Xcode 8
在 Xcode 8 中,正如 Bruce 所说,当 Qt 试图寻找 xcrun
而它应该寻找 xcodebuild
时,就会发生这种情况.
In Xcode 8, as Bruce said, this happens when Qt tries to find xcrun
when it should be looking for xcodebuild
.
打开文件:
Qt_install_folder/5.7/clang_64/mkspecs/features/mac/default_pre.prf
替换:
isEmpty($$list($$system("/usr/bin/xcrun -find xcrun 2>/dev/null")))
与:
isEmpty($$list($$system("/usr/bin/xcrun -find xcodebuild 2>/dev/null")))
~>Xcode 8
Xcode 8 之前,在安装 Xcode 后安装命令行工具时会出现此问题.发生的事情是 Xcode-select
开发者目录被指向 /Library/Developer/CommandLineTools
.
Before Xcode 8, this problem occurs when command line tools are installed after Xcode is installed. What happens is the Xcode-select
developer directory gets pointed to /Library/Developer/CommandLineTools
.
使用以下命令将 Xcode-select
指向正确的 Xcode Developer 目录:
Point Xcode-select
to the correct Xcode Developer directory with the command:
sudo xcode-select -switch /Applications/Xcode.app/Contents/Developer
使用命令确认许可协议:
Confirm the license agreement with the command:
sudo xcodebuild -license
这将提示您通读许可协议.
This will prompt you to read through the license agreement.
输入同意
以接受条款.
相关文章