如何使用'xcode-select'为Qt安装设置活动开发者目录?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/38196572/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-15 09:00:31  来源:igfitidea点击:

How to set active developer directory with ‘xcode-select’ for Qt installation?

xcodemacosqt

提问by tim_xyz

I'm trying to install the latest version of Qtfor mac (https://www.qt.io/). But when I try to install I get an error.

我正在尝试安装最新版本的Qtfor mac ( https://www.qt.io/)。但是当我尝试安装时出现错误。

You need to install Xcode http://developer.apple.com/xcode. If already installed, then set active developer directory with ‘xcode-select'.

您需要安装 Xcode http://developer.apple.com/xcode。如果已安装,则使用“xcode-select”设置活动开发人员目录。

I've now installed xcode 7.3.1, and then ran the following in terminal:

我现在已经安装xcode 7.3.1,然后在终端中运行以下命令:

sudo xcode-select -switch /Applications/Xcode.app

But I'm still running into the same error (see screenshot).

但我仍然遇到同样的错误(见截图)。

enter image description here

在此处输入图片说明

Can anyone advise how I might troubleshoot this?

谁能建议我如何解决这个问题?

回答by cstarcher

This fixed my error.

这修复了我的错误。

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

It came from the answer here. https://stackoverflow.com/a/17980786/2009221

它来自这里的答案。https://stackoverflow.com/a/17980786/2009221

The first time I clicked OK the error reappeared. The second time it was accepted and the installation continued.

我第一次单击“确定”时,错误再次出现。第二次被接受,安装继续。

回答by A-Dubb

sudo xcode-select -s /Applications/Xcode.app/Contents/Developerdid not work for me as xcode-select still marked the directory as invalid. I created a symlink to homebrew's internal target xcode dev tools directory via:

sudo xcode-select -s /Applications/Xcode.app/Contents/Developer对我不起作用,因为 xcode-select 仍将目录标记为无效。我通过以下方式创建了一个指向自制软件的内部目标 xcode 开发工具目录的符号链接:

sudo ln -s /Applications/Xcode.app/Contents/Developer /Library/Developer/CommandLineTools

sudo ln -s /Applications/Xcode.app/Contents/Developer /Library/Developer/CommandLineTools

Reinstalling homebrew after creating the above symlink worked for me.

创建上述符号链接后重新安装自制软件对我有用。

回答by rich

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

须藤 xcode-select -switch /Applications/Xcode.app/Contents/Developer