Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can you create Mac .app distribution from the command-line instead of from within Xcode?

Tags:

xcode

macos

build

Is it possible to go from an .xcarchive bundle to an .app bundle without using the Xcode Organizer? I'd like to create an automated build and get the final .app file that I can distribute. Using xcodebuild with the archive target works great for getting the .xcarchive file, but not for the final app.

With the iOS SDK, there's a PackageApplication tool you can use with xcrun, but this doesn't appear to exist with the OS X SDK.

I'd also like to do this so I can hopefully get more diagnostics from the Distribution process, which is failing for me right now with the infamous 100021 OS error code.

like image 350
dcgibbons Avatar asked Feb 18 '23 05:02

dcgibbons


2 Answers

Have you looked inside the .xcarchive bundle? It's just a folder. Your .app targets should be inside, in a Products subfolder.

In Finder, right-click the archive and click Show Package Contents. in Terminal, use cd.

like image 176
paulmelnikow Avatar answered May 12 '23 00:05

paulmelnikow


Try the -exportArchive flag in the xcodebuild command:

xcodebuild -exportArchive -exportFormat app -archivePath <path to .xcarchive> -exportPath "My App.app" -exportSigningIdentity "Developer ID Application: My Software Company"

This command is present in Xcode 5.0.1. See the man page for more details on the optional arguments. This example exports a Developer ID signed application.

like image 26
Nik Avatar answered May 12 '23 01:05

Nik