8

I have a build script that exports an OS X app to a .app file. This is the equivalent of going into xcode and archiving, then choosing export, then choosing the 'Export as a macOS App'. The script used to work just fine, until the -exportFormat flag was removed from xcodebuild. Now the script does not work at all. I have not had any luck determining what the new flags should be.

I have looked into the -exportoptionsplist flag, but I don't know what to put in my plist, or if this is even the correct solution. The relevant lines from the script are below:

#Archive the app
xcodebuild -workspace '/path/project.xcworkspace' -config Release -scheme 'Some Scheme' -archivePath ./archive archive

#Export the archive as in the APP format
xcodebuild -archivePath archive.xcarchive -exportArchive -exportPath 'exportedApp.app' -exportFormat App

How can I get result that -exportFormat App used to provide?

  • I was able to get around this issue by looking at https://stackoverflow.com/questions/11965040/xcodebuilding-a-workspace-and-setting-a-custom-build-path. I used the CONFIGURATION_BUILD_DIR option and xcodebuild put the compiled .app file into the directory I specified. However, it would still be nice to know how to export an .app from an archive. Also, is there anything special about exporting the .app from the archive? Is the app file the same as the one you get when specifying CONFIGURATION_BUILD_DIR? – Snuggles-With-Bunnies May 31 '17 at 15:22

1 Answers1

4

Use

xcodebuild \
-archivePath archive.xcarchive \
-exportArchive -exportPath 'exportedApp.app'\
-exportOptionsPlist exportOptions.plist

And set method = developer-id exportOptions.plist.

Yoav
  • 5,962
  • 5
  • 39
  • 61
  • Just saying that in my case, if I do "-exportPath 'exportedApp.app'" it generates an invalid app file. As of today with Xcode 14.3, Build version 14E222b, just use "-exportPath path-to-store" (no extension!), and it will place the file in there. – Markon Aug 23 '23 at 19:46