xcodebuild 使用哪个版本的 Xcode?
我在同一台机器上安装了 Xcode 3.2 和 Xcode 4.0.2,它使用 Hudson 进行自动化 CI(持续集成)构建。当我说两者都已安装时,我的意思是我可以同时或交替使用 Xcode 3 和 Xcode 4。它们都存在于机器上,因为我为 Xcode 4 进行了自定义安装,而没有覆盖 Xcode 3(据说)。
- 对“xcodebuild”的命令行调用会调用 Xcode 3 或 Xcode 4 吗?
- 这个问题有意义吗?某个可能了解或不了解该主题的人要求某些项目使用 3 构建,有些项目使用 4 构建。
- 如果是这样,我如何强制它使用 3 或 4?
- 或者,是否有一个单独的位置来存储 Xcode 3 的“xcodebuild”和 Xcode4 的“xcodebuild”的存储位置?如果有,我可以在构建脚本中使用不同的路径。
I have installed both Xcode 3.2 and Xcode 4.0.2 on the same machine, which uses Hudson for automated CI (continuous integration) builds. When I say that both were installed, what I mean by that is that I can use both Xcode 3 and Xcode 4 simultaneously or interchangeably. They both exist on the machine, as I did a custom install for Xcode 4 without overwriting Xcode 3 (supposedly).
- Do command line calls to 'xcodebuild' invoke Xcode 3 or Xcode 4?
- Does that question even make sense? Someone who may or may not be knowledgable on the topic is requesting that some projects be built with 3 and some with 4.
- If so, how do I force it to use 3 or 4?
- alternatively, is there a separate location where Xcode 3's 'xcodebuild' is stored vs. where Xcode4's 'xcodebuild' is stored? If there is, I can just use a different path in my build script.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
您可以通过
xcode-select -print-path
了解 xcodebuild 使用的版本。另外,使用xcode-select -switch
更改为不同版本You can find out what version is xcodebuild using with
xcode-select -print-path
. Also, change to a different version usingxcode-select -switch <path>
另外,要确定正在使用哪个 XCode 环境,请使用命令
xcodebuild -version
。Also, to determine which XCode environment is being used, use the command
xcodebuild -version
.在终端之外,您可以在 Xcode 中查看和更改它。
打开首选项,然后选择位置选项卡。在底部附近,标题为命令行工具的条目标记了一个下拉列表,其选择对应于
xcodebuild
中使用的Xcode版本。您可以打开此下拉列表来选择已安装在
/Applications
或~/Applications
文件夹中的另一个 Xcode 版本。有趣的是,这个面板只说明了这个弹出菜单的作用,如果您选择了不同版本的 Xcode,它类似于
xcode-select
比 如果您需要它,我还有一张屏幕截图,显示它过去的样子Xcode 8。
Outside the terminal, you can view and change this in Xcode.
Open Preferences, then select the Locations tab. Near the bottom, an entry titled Command Line Tools labels a dropdown, whose selection corresponds to the version of Xcode used in
xcodebuild
.You may open this dropdown to select another version of Xcode that you have installed in your
/Applications
or~/Applications
folder.Interestingly, this panel only says what this pop-up menu does and that it's analogous to
xcode-select
if you've selected a different version of Xcode than the one it's running in.In case you need it, I also have a screenshot from what this used to look like in Xcode 8.
我们不使用 xcode-select 的原因之一是我们不是管理员或不在 sudo 列表中。
我们可以选择xcodebuild而不使用默认的。
运行
xcode-select -p
,我们可能会得到/Applications/Xcode.app/Contents/Developer
,并且xcodebuild位于/Applications/Xcode这个文件夹中。 app/Contents/Developer/usr/bin/xcodebuild
因此,如果我们安装了另一个 Xcode,请找到该文件夹以及该 xcodebuild。
One reason we don't use xcode-select is we are not admin or not in sudo list.
we can choose the xcodebuild and not use the default one.
Run
xcode-select -p
and we might get/Applications/Xcode.app/Contents/Developer
, and the xcodebuild is in this folder/Applications/Xcode.app/Contents/Developer/usr/bin/xcodebuild
So if we have installed another Xcode, find the folder and along with that xcodebuild.