Xcode 4.5 命令行工具 - xcode-select 问题

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/12780858/
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 01:44:08  来源:igfitidea点击:

Xcode 4.5 Command Line Tools - xcode-select issue

xcodexcodebuild

提问by ddario

After installing Xcode CLT 4.5.1 on OS X 10.8.2, I'm having issues installing native ruby gems which need to compiled.

在 OS X 10.8.2 上安装 Xcode CLT 4.5.1 后,我在安装需要编译的本机 ruby​​ gem 时遇到问题。

The output error is the same as with running xcrun -find:

输出错误与运行 xcrun -find 相同:

xcode-select: Error: No Xcode is selected. Use xcode-select -switch , or
see the xcode-select manpage (man xcode-select) for further information.

xcode-select:错误:未选择 Xcode。使用 xcode-select -switch ,或
查看 xcode-select 联机帮助页 (man xcode-select) 以获取更多信息。

To which CLT location should xcode-selectpoint to, since it's no longer at /Developer?

xcode-select应该指向哪个 CLT 位置,因为它不再位于 /Developer?

Edit: I don't have the Xcode app installed, only CLT.

编辑:我没有安装 Xcode 应用程序,只有 CLT。

回答by jbowes

The new location seems to be (be sure to run as root):

新位置似乎是(一定要以 root 身份运行):

sudo xcode-select -switch /Library/Developer/

回答by konyak

Since your Xcode tools are installed in /usr/bin, you should

由于您的 Xcode 工具安装在 /usr/bin 中,您应该

sudo xcode-select -switch /

回答by Warren P

With XCode 4.5 installed AND Command Line Tools installed, I had to use this to get MacPorts and other similar things (like Ruby Gems or Perl CPAN module installation) working:

安装了 XCode 4.5 和命令行工具后,我必须使用它来让 MacPorts 和其他类似的东西(如 Ruby Gems 或 Perl CPAN 模块安装)工作:

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

I found that /Library/Developer did not work. Note that the Developer folder is not under /Library for me, it's under the app bundle file content folders.

我发现 /Library/Developer 不起作用。请注意,Developer 文件夹对我来说不在 /Library 下,而是在 app bundle 文件内容文件夹下。

I'm not sure why this is, but people googling this issue may come here and want to know the other commandline options that are commonly usable with xcode-select, thus this answer, even though it doesn't 100% apply to the original question (where command line tools are installed WITHOUT XCode).

我不确定为什么会这样,但是在谷歌上搜索这个问题的人可能会来到这里并想知道 xcode-select 通常可用的其他命令行选项,因此这个答案,即使它不是 100% 适用于原始问题(在没有 XCode 的情况下安装命令行工具的地方)。

回答by justin

you probablywant:

可能想要:

xcode-select -switch /Applications/Xcode.app

unless you have multiple installs. that is likely the location if you have one install (e.g. from the App Store). if you have multiple installs, you probably know which one you want.

除非你有多个安装。如果您安装了一次(例如从 App Store),这可能就是该位置。如果您有多个安装,您可能知道您想要哪一个。

you could also try updating this value from Xcode's Preferences > Locations > Command Line Toolspopup.

您也可以尝试从 Xcode 的Preferences > Locations > Command Line Tools弹出窗口更新此值。

回答by spuder

Open XCode and go to preferences.

打开 XCode 并转到首选项。

Verify that there is an option under "Command Line Tools"

验证“命令行工具”下是否有选项

The error went away for me, as soon as I specified my Xcode command line tools version. enter image description here

一旦我指定了我的 Xcode 命令行工具版本,错误就消失了。 在此处输入图片说明

回答by Stano

I got further from @jbowes xcode-select -switch /Library/Developer/answer, but then I hit this:

我从@jbowes 的xcode-select -switch /Library/Developer/回答中走得更远,但后来我打了这个:

xcrun: Error: failed to exec real xcrun. (No such file or directory)

I came across this thread (OSX 10.8 xcrun (No such file or directory)) which references a Gist that solved my problem:

我遇到了这个线程(OSX 10.8 xcrun(没有这样的文件或目录)),它引用了一个解决我问题的要点:

https://gist.github.com/thelibrarian/5520597

https://gist.github.com/thelibrarian/5520597

It's gross, but it seems to be the only way to solve the issue with just the Command Line Tools (i.e. not a full-blown XCode installation).

这很糟糕,但它似乎是仅使用命令行工具(即不是完整的 XCode 安装)解决问题的唯一方法。