Search code examples
xcode10notarize

xcodebuild to notarize mac app and wait for response?


I heavily rely on xcodebuild to automate the build process. Developers can now notarize their mac Developer ID apps before distribution, in Xcode 10.

I realize notarisation is an asynchronous process, one which involves waiting for Apple to 'review' and approve the app. In practice this seems to take less than 5 to 10 minutes.

Has anyone been able to automate this using the command line so we don't have to touch or use the Xcode Archiver Window? I cannot find a way. There seems to only be a -exportNotarizedApp option, which presumably only works if you already have the app notarised. No way to request notarization using the command line?


Solution

  • An asynchronous notarization process can be automated using a new tool from Xcode toolchain named altool. You can read its documentation by running xcrun altool in the Terminal.

    P. S. I wrote a blog post with a working script, if this helps.