使用 cli 工具包时的 xcode-select -switch 路径

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

xcode-select -switch path when using cli toolkit

xcodepathtoolkit

提问by Lukas

With the release of Apple's Command Line Toolkit for Xcode, I am trying to avoid needing to install Xcode proper. In order to do this, I need to set the path to xcode for specific make files that depend on the xcode-select path (which is currently pointing to /Developer)

随着 Apple 的 Xcode 命令行工具包的发布,我试图避免需要正确安装 Xcode。为此,我需要为依赖于 xcode-select 路径(当前指向 /Developer)的特定 make 文件设置 xcode 的路径

Where do I point the xcode-select path when using the CLI Toolkit for Xcode?

使用 CLI Toolkit for Xcode 时,我应该将 xcode-select 路径指向哪里?

If I install Xcode, it's just /Applications/Xcode.app, but I don't know where the CLI Toolkit is being placed.

如果我安装 Xcode,它只是/Applications/Xcode.app,但我不知道 CLI Toolkit 被放置在哪里。

Thanks.

谢谢。

UPDATE:

更新:

It appears from the pkg installer that it dumps it all to /usr/bin and then xcode-select or other scripts internal to the pkg create the paths for xcodebuilder etc. Can anyone confirm?

从 pkg 安装程序看来,它将所有内容转储到 /usr/bin,然后 xcode-select 或 pkg 内部的其他脚本为 xcodebuilder 等创建路径。谁能确认?

回答by billzhong

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

回答by chrischris

I installed the CLI tools only (e.g. no Xcode) and received an error with a native gem extension build:

我只安装了 CLI 工具(例如没有 Xcode)并收到一个带有原生 gem 扩展构建的错误:

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

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

After looking at this and browsing the directories, it appears the BSD tools got installed in /usr/bintherefore:

在查看并浏览目录后,似乎 BSD 工具已安装在/usr/bin

sudo xcode-select -switch /

seems to work.

似乎工作。

回答by Ben Mosher

Just did this today after removing Xcode to reclaim HD space. I used:

在删除 Xcode 以回收 HD 空间后,今天才这样做。我用了:

sudo xcode-select -s /Library/Developer/CommandLineTools

回答by Amir Rubin

For my setup (Xcode 4.0.2 on 10.6.8), I used spotlight to search for 'xcodebuild' to find where the Xcode CLI tools actually live.

对于我的设置(10.6.8 上的 Xcode 4.0.2),我使用了聚光灯来搜索“xcodebuild”以查找 Xcode CLI 工具实际所在的位置。

The CLI tools are in /Developer/usr/bin, so my xcode-select command looks like (the /usr/bin is appended by xcode-select):

CLI 工具在 /Developer/usr/bin 中,所以我的 xcode-select 命令看起来像(/usr/bin 由 xcode-select 附加):

sudo xcode-select -switch /Developer