找出 Xcode 命令行工具的路径位置
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/18533761/
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
Find out the path location to Command Line Tools for Xcode
提问by Alexander
I didn't want to install the whole XCode, so I just downloaded the command line tools for Xcode. I am trying to install ruby 1.9.3 via rvm. However, rvm complains that no xcode is selected:
我不想安装整个 XCode,所以我只下载了 Xcode 的命令行工具。我正在尝试通过 rvm 安装 ruby 1.9.3。但是,rvm 抱怨没有选择 xcode:
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) 以获取更多信息。
I read the xcode-select manpage and I know how to set the path to the xcode command line tools, but I don't know where they are installed. How do I find this out?
我阅读了 xcode-select 联机帮助页,我知道如何设置 xcode 命令行工具的路径,但我不知道它们的安装位置。我怎么知道这个?
I am using OS X Mountain Lion.
我正在使用 OS X Mountain Lion。
回答by Matthias Winkelmann
The entries in /usr/bin
are just a front for whatever you choose with xcode-select
:
中的条目/usr/bin
只是您选择的任何内容的前面xcode-select
:
$> /usr/bin/clang --version
Apple LLVM version 8.0.0 (clang-800.0.38)
Target: x86_64-apple-darwin15.6.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
The standalone command line tools are installed in /Library/Developer/CommandLineTools
:
独立命令行工具安装在/Library/Developer/CommandLineTools
:
$> sudo xcode-select -s /Library/Developer/CommandLineTools
$> /usr/bin/clang --version
Apple LLVM version 7.3.0 (clang-703.0.31)
Target: x86_64-apple-darwin15.6.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin
回答by Alexander
Short version: the answer to my problem is to install the full Xcode, not only the Command Line Tools.
简短版本:我的问题的答案是安装完整的 Xcode,而不仅仅是命令行工具。
Long version:
长版:
Based on thisI found out, that the location of the tools is /usr/bin . So I ran sudo xcode-select -switch /usr/bin
. After that however, I got this error:
基于此,我发现工具的位置是 /usr/bin 。所以我跑了sudo xcode-select -switch /usr/bin
。然而,在那之后,我收到了这个错误:
Error: failed to exec real xcrun. (No such file or directory)
错误:无法执行真正的 xcrun。(无此文件或目录)
So based on thisI install the full Xcode app, ran sudo xcode-select -switch /Applications/Xcode.app/Contents/Developer
and this solved my problem.
因此,基于此,我安装了完整的 Xcode 应用程序,然后运行sudo xcode-select -switch /Applications/Xcode.app/Contents/Developer
并解决了我的问题。
回答by mpapis
this is not warning from RVM, most likely it is displayed by Homebrew, I got few complains about it but it was always harmless and installation of ruby completed without problems.
这不是来自 RVM 的警告,很可能是 Homebrew 显示的,我很少抱怨它,但它总是无害的,并且 ruby 的安装没有问题。
if you get errors show all of them not just one.
如果您收到错误,请显示所有错误,而不仅仅是一个。