xcodebuild命令官方说明

XcodeBuild命令介绍

原料:Xcode 7.3 Build version 7D175

使用方法一:

xcodebuild
[-project <projectname>] #项目名称
[[-target <targetname>]...|-alltargets] #target名称
[-configuration <configurationname>] #configuration名称
[-arch <architecture>]...
[-sdk [<sdkname>|<sdkpath>]] #SDK名称
[-showBuildSettings]
[<buildsetting>=<value>]... 
[<buildaction>]... 

使用方法二:

xcodebuild
[-project <projectname>] #项目名称
-scheme <schemeName> #scheme名称
[-destination <destinationspecifier>]... 
[-configuration <configurationname>] 
[-arch <architecture>]... 
[-sdk [<sdkname>|<sdkpath>]] 
[-showBuildSettings] 
[<buildsetting>=<value>]... 
[<buildaction>]...

使用方法三:

xcodebuild 
-workspace <workspacename> 
-scheme <schemeName> 
[-destination <destinationspecifier>]... 
[-configuration <configurationname>] 
[-arch <architecture>]... 
[-sdk [<sdkname>|<sdkpath>]] 
[-showBuildSettings] 
[<buildsetting>=<value>]... 
[<buildaction>]...

基本命令

  • 查看xcodebuild简洁用法xcodebuild -usage
  • 查看已安装的SDKxcodebuild -showsdks
  • 查看安装的版本号
xcodebuild
-version 
[-sdk [<sdkfullpath>|<sdkname>] [<infoitem>] ]
例子:
1.xcodebuild -version
2.xcodebuild -version -sdk iphonesimulator9.3
  • 查看项目中的Targets、Configurations和Schemes
xcodebuild 
-list 
[[-project <projectname>]|[-workspace <workspacename>]]
例子:
1.xcodebuild -list
2.xcodebuild -list -workspace test.xcworkspace
  • 导出Archive
xcodebuild 
-exportArchive 
-archivePath <xcarchivepath> 
-exportPath <destinationpath> 
-exportOptionsPlist <plistpath>
  • exportLocalizations
xcodebuild 
-exportLocalizations 
-localizationPath <path> 
-project <projectname> 
[-exportLanguage <targetlanguage>...]
  • importLocalizations
xcodebuild 
-importLocalizations 
-localizationPath <path> 
-project <projectname>

可选命令

xcodebuild [-xxx]...
例如:xcodebuild -usage
可选命令 说明 谷歌翻译
-usage print brief usage 查看xcodebuild简洁的用法
-help print complete usage 查看帮助
-verbose provide additional status output 提供额外的状态输出
-license show the Xcode and SDK license agreements 显示Xcode和SDK许可协议
-checkFirstLaunchStatus Check if any First Launch tasks need to be performed 检查是否有任何初启动任务需要执行
-project NAME build the project NAME 编译项目名称,例如:xcodebuild -project XXX.xcodeproj
-target NAME build the target NAME 编译目标名称
-targets build all targets 编译全部目标
-workspace NAME build the workspace NAME 编译工作空间名称
-scheme NAME build the scheme NAME 编译计划名称
-configuration NAME use the build configuration NAME for building each target 为构建每一个目标使用build配置名称
-xcconfig PATH apply the build settings defined in the file at PATH as overrides 在PATH作为替代应用文件中定义的构建设置
-arch ARCH build each target for the architecture ARCH; this will override architectures defined in the project 建立每个目标的架构ARCH;这将覆盖在项目中定义的架构
-sdk SDK use SDK as the name or path of the base SDK when building the project 使用指定的SDK编译项目
-toolchain NAME use the toolchain with identifier or name NAME 使用工具链与标识或名称
-destination DESTINATIONSPECIFIER use the destination described by DESTINATIONSPECIFIER (a comma-separated set of key=value pairs describing the destination to use) 使用由目标说明(用逗号分隔的一系列的key =描述目的地使用值对)中描述的目的地
-destination-timeout TIMEOUT wait for TIMEOUT seconds while searching for the destination device 等待TIMEOUT秒,而搜索的目标设备
-parallelizeTargets build independent targets in parallel 建立并行独立目标
-jobs NUMBER specify the maximum number of concurrent build operations 指定并发生成操作的最大数量
-dry-run do everything except actually running the commands 做一切,除了实际运行的命令
-hideShellScriptEnvironment don't show shell script environment variables in build log 不显示在构建日志shell脚本中的环境变量
-showsdks display a compact list of the installed SDKs 显示已安装的SDK的列表
-showBuildSettings display a list of build settings and values 显示构建设置和值的列表
-list lists the targets and configurations in a project, or the schemes in a workspace 列出了在一个工作空间中的一个项目的目标和配置,或方案
-find-executable NAME display the full path to executable NAME in the provided SDK and toolchain 在所提供的SDK和工具链显示的完整路径可执行文件名称
-find-library NAME display the full path to library NAME in the provided SDK and toolchain 在所提供的SDK和工具链显示的完整路径库名
-version display the version of Xcode; with -sdk will display info about one or all installed SDKs 显示的Xcode的版本;与-sdk将显示一个或所有已安装的SDK信息
-enableAddressSanitizer YES/NO turn the address sanitizer on or off when testing 测试时打开或关闭地址过滤
-resultBundlePath PATH specifies the directory where a result bundle describing what occurred will be placed 指定在描述什么发生了捆绑的结果将被放置的目录
-derivedDataPath PATH specifies the directory where build products and other derived data will go 指定的目录中生成产品和其他衍生数据会
-archivePath PATH specifies the directory where any created archives will be placed, or the archive that should be exported 被指定任何创建的档案将被放置的目录,或应导出存档
-exportArchive specifies that an archive should be exported 指定归档应导出
-exportOptionsPlist PATH specifies a path to a plist file that configures archive exporting 指定用于配置归档导出plist文件的路径
-enableCodeCoverage YES/NO turn code coverage on or off when testing 打开代码覆盖率或关闭时的测试
-exportPath PATH specifies the destination for the product exported from an archive 指定从存档导出的产品的目标
-skipUnavailableActions specifies that scheme actions that cannot be performed should be skipped instead of causing a failure 指定不能执行计划的行动应被跳过而不是导致失败
-exportLocalizations exports completed and outstanding project localizations 出口完成优秀项目本地化
-importLocalizations imports localizations for a project, assuming any necessary localized resources have been created in Xcode 进口本地化项目,假设任何必要的本地化资源在Xcode中已创建
-localizationPath specifies a path to XLIFF localization files 指定XLIFF本地化文件路径
-exportLanguage specifies multiple optional ISO 639-1 languages included in a localization export 规定包括在本地化出口多个可选ISO 639-1语言

-exportOptionsPlist PATH 指定plist文件内容格式

Key value 说明 谷歌翻译
compileBitcode Bool For non-App Store exports, should Xcode re-compile the app from bitcode? Defaults to YES 对于非App Store的出口,应重新编译Xcode中从bitcode应用程序?默认为YES
embedOnDemandResourcesAssetPacksInBundle Bool For non-App Store exports, if the app uses On Demand Resources and this is YES, asset packs are embedded in the app bundle so that the app can be tested without a server to host asset packs. Defaults to YES unless onDemandResourcesAssetPacksBaseURL is specified 对于非App Store的出口,如果应用程序使用按需的资源,这是YES,资产包被嵌入在应用程序包,使应用程序可以在没有服务器托管资产包进行测试。默认为YES除非指定onDemandResourcesAssetPacksBaseURL
iCloudContainerEnvironment For non-App Store exports, if the app is using CloudKit, this configures the "com.apple.developer.icloud-container-environment" entitlement. Available options: Development and Production. Defaults to Development 对于非App Store的出口,如果应用程序使用CloudKit,这种配置“com.apple.developer.icloud容器环境”的权利。可用选项:开发和生产。默认为发展
manifest Dictionary For non-App Store exports, users can download your app over the web by opening your distribution manifest file in a web browser. To generate a distribution manifest, the value of this key should be a dictionary with three sub-keys: appURL, displayImageURL, fullSizeImageURL. The additional sub-key assetPackManifestURL is required when using on demand resources 对于非App Store的出口,用户可以通过在Web浏览器中打开您的分发清单文件下载你的应用程序在网上。要生成分布明显,此键的值应该是有三个子键的字典:appURL,displayImageURL,fullSizeImageURL。额外的子键assetPackManifestURL是按需使用资源时,需要。
method String Describes how Xcode should export the archive. Available options: app-store, ad-hoc, package, enterprise, development, and developer-id. The list of options varies based on the type of archive. Defaults to development Xcode中描述如何导出存档。可用选项:应用程序商店,即席,包装,企业发展,开发人员ID。选项列表会有所不同根据存档的类型。默认为发展
onDemandResourcesAssetPacksBaseURL String For non-App Store exports, if the app uses On Demand Resources and embedOnDemandResourcesAssetPacksInBundle isn't YES, this should be a base URL specifying where asset packs are going to be hosted. This configures the app to download asset packs from the specified URL 对于非App Store的出口,如果应用程序使用按需资源embedOnDemandResourcesAssetPacksInBundle不是YES,这应该是一个基本URL指定,其中资产包将要举行。该配置应用从指定的URL下载资产包
teamID String The Developer Portal team to use for this export. Defaults to the team used to build the archive 开发者门户网站团队使用这个出口。默认为球队用来建立档案
thinning String For non-App Store exports, should Xcode thin the package for one or more device variants? Available options: <none> (Xcode produces a non-thinned universal app), <thin-for-all-variants> (Xcode produces a universal app and all available thinned variants), or a model identifier for a specific device (e.g. "iPhone7,1"). Defaults to <none> 对于非App Store的出口,Xcode中应该薄包一个或多个设备的变种?可用选项:<无>(Xcode中产生的非变薄普遍的应用程序),<薄参加的所有变体>(Xcode中产生一个通用的应用程序以及所有可用的变薄变型),或针对特定设备型号标识(例如“ iPhone7,1“)。默认为<无>
uploadBitcode Bool For App Store exports, should the package include bitcode? Defaults to YES 对于App Store的导出,应包包括bitcode?默认为YES
uploadSymbols Bool For App Store exports, should the package include symbols? Defaults to YES 对于App Store的出口,应包包含符号?默认为YES

附录:xcodebuild命令简单使用

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
  • 序言:七十年代末,一起剥皮案震惊了整个滨河市,随后出现的几起案子,更是在滨河造成了极大的恐慌,老刑警刘岩,带你破解...
    沈念sama阅读 157,373评论 4 361
  • 序言:滨河连续发生了三起死亡事件,死亡现场离奇诡异,居然都是意外死亡,警方通过查阅死者的电脑和手机,发现死者居然都...
    沈念sama阅读 66,732评论 1 290
  • 文/潘晓璐 我一进店门,熙熙楼的掌柜王于贵愁眉苦脸地迎上来,“玉大人,你说我怎么就摊上这事。” “怎么了?”我有些...
    开封第一讲书人阅读 107,163评论 0 238
  • 文/不坏的土叔 我叫张陵,是天一观的道长。 经常有香客问我,道长,这世上最难降的妖魔是什么? 我笑而不...
    开封第一讲书人阅读 43,700评论 0 202
  • 正文 为了忘掉前任,我火速办了婚礼,结果婚礼上,老公的妹妹穿的比我还像新娘。我一直安慰自己,他们只是感情好,可当我...
    茶点故事阅读 52,036评论 3 286
  • 文/花漫 我一把揭开白布。 她就那样静静地躺着,像睡着了一般。 火红的嫁衣衬着肌肤如雪。 梳的纹丝不乱的头发上,一...
    开封第一讲书人阅读 40,425评论 1 211
  • 那天,我揣着相机与录音,去河边找鬼。 笑死,一个胖子当着我的面吹牛,可吹牛的内容都是我干的。 我是一名探鬼主播,决...
    沈念sama阅读 31,737评论 2 310
  • 文/苍兰香墨 我猛地睁开眼,长吁一口气:“原来是场噩梦啊……” “哼!你这毒妇竟也来了?” 一声冷哼从身侧响起,我...
    开封第一讲书人阅读 30,421评论 0 194
  • 序言:老挝万荣一对情侣失踪,失踪者是张志新(化名)和其女友刘颖,没想到半个月后,有当地人在树林里发现了一具尸体,经...
    沈念sama阅读 34,141评论 1 239
  • 正文 独居荒郊野岭守林人离奇死亡,尸身上长有42处带血的脓包…… 初始之章·张勋 以下内容为张勋视角 年9月15日...
    茶点故事阅读 30,398评论 2 243
  • 正文 我和宋清朗相恋三年,在试婚纱的时候发现自己被绿了。 大学时的朋友给我发了我未婚夫和他白月光在一起吃饭的照片。...
    茶点故事阅读 31,908评论 1 257
  • 序言:一个原本活蹦乱跳的男人离奇死亡,死状恐怖,灵堂内的尸体忽然破棺而出,到底是诈尸还是另有隐情,我是刑警宁泽,带...
    沈念sama阅读 28,276评论 2 251
  • 正文 年R本政府宣布,位于F岛的核电站,受9级特大地震影响,放射性物质发生泄漏。R本人自食恶果不足惜,却给世界环境...
    茶点故事阅读 32,907评论 3 233
  • 文/蒙蒙 一、第九天 我趴在偏房一处隐蔽的房顶上张望。 院中可真热闹,春花似锦、人声如沸。这庄子的主人今日做“春日...
    开封第一讲书人阅读 26,018评论 0 8
  • 文/苍兰香墨 我抬头看了看天上的太阳。三九已至,却和暖如春,着一层夹袄步出监牢的瞬间,已是汗流浃背。 一阵脚步声响...
    开封第一讲书人阅读 26,772评论 0 192
  • 我被黑心中介骗来泰国打工, 没想到刚下飞机就差点儿被人妖公主榨干…… 1. 我叫王不留,地道东北人。 一个月前我还...
    沈念sama阅读 35,448评论 2 269
  • 正文 我出身青楼,却偏偏与公主长得像,于是被迫代替她去往敌国和亲。 传闻我的和亲对象是个残疾皇子,可洞房花烛夜当晚...
    茶点故事阅读 35,325评论 2 261

推荐阅读更多精彩内容