xcode 如何在命令行中使用 xcodebuild?

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

How can I use xcodebuild in command line?

objective-cxcodemacos

提问by Spark

I'm a newbie to xcode. I'm using xcode 4.3 with lion. I want to use xcodebuild in command line, but it report "no such file". I searched it with Finder, but no result.

我是 xcode 的新手。我正在使用带有狮子的 xcode 4.3。我想在命令行中使用 xcodebuild,但它报告“没有这样的文件”。我用Finder搜索了它,但没有结果。

What is this file's path? Does it exist in the Xcode.app? Can I search files in a .app package?

这个文件的路径是什么?它是否存在于 Xcode.app 中?我可以搜索 .app 包中的文件吗?

Additional info: When I typed "which xcodebuild", it return /usr/bin/xcodebuild. Enter this folder, and type xocdebuild, it still return Error:

附加信息:当我输入“which xcodebuild”时,它返回/usr/bin/xcodebuild。进入这个文件夹,输入xocdebuild,还是返回错误:

Can't run /Applications/usr/bin/xcodebuild (no such file).

采纳答案by Conrad Shultz

The installer put mine in

安装人员把我的放进去

/usr/bin/xcodebuild

You can also find it in the application bundle:

您还可以在应用程序包中找到它:

/Applications/Xcode.app/Contents/Developer/usr/bin/xcodebuild

回答by Juan Enrique Mu?oz Zolotoochin

/usr/bin/xcodebuildonly calls the xcodebuildcommand from the developer tools directory given by xcode-select. To find out the current developer tools directory as given by xcode-selectrun

/usr/bin/xcodebuild仅调用xcodebuild与给定的开发者工具目录命令xcode-select。找出xcode-select运行给出的当前开发人员工具目录

xcode-select -print-path

I fixed the issue by changing that path executing

我通过更改执行路径解决了这个问题

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

Which is where my developer tools are. You should change /Applications/Xcode.appto wherever your Xcode application is.

这是我的开发人员工具所在的位置。您应该更改/Applications/Xcode.app为 Xcode 应用程序所在的位置。

回答by drekka

CHeck you have it installed. The command Line Tools for the latest XCodes are optional installs. You can install them from Xcode's preferences - Downloads Tab - Components.

检查您是否安装了它。最新 XCode 的命令行工具是可选安装。您可以从 Xcode 的首选项 - 下载选项卡 - 组件中安装它们。