How to notarize your software on macOS

Apple now wants you to ‘notarize’ your software. This is a process where you upload your software to Apple’s server so it can be scanned and certified malware free. This will probably become compulsory at some point, even (especially?) if your software isn’t in the Apple app store. Apple says:

Give users even more confidence in your software by submitting it to Apple to be notarized. The service automatically scans your Developer ID-signed software and performs security checks. When it’s ready to export for distribution, a ticket is attached to your software to let Gatekeeper know it’s been notarized.

When users on macOS Mojave first open a notarized app, installer package, or disk image, they’ll see a more streamlined Gatekeeper dialog and have confidence that it is not known malware.

Note that in an upcoming release of macOS, Gatekeeper will require Developer ID signed software to be notarized by Apple.

Documentation on notarization is a bit thin on the ground, especially if you want to notarize software that wasn’t built using XCode (I build my software using QtCreator). So I am writing up my experiences here.

First you need to ensure you have macOS 10.14 and XCode 10 installed (with command line tools) and you need a current Apple developer account.

Codesign your app with ‘hardened runtime’ using --options runtime :

codesign --deep --force --verify --verbose --sign "Developer ID Application:<developer id>" --options runtime <app file>


codesign --deep --force --verify --verbose --sign "Developer ID Application: Acme Ltd" --options runtime

A ‘hardened runtime’ limits the data and resourced an application can access. I’m not sure what the exact ramification of this are. But it doesn’t seem to have restrict my software from doing anything it could do previously.

You can check the signing with:

codesign --verify --verbose=4 <app file>


codesign --verify --verbose=4

Now package your app into a .dmg (e.g. using DropDMG). Then upload the .dmg to Apple’s servers:

xcrun altool -t osx -f <dmg file> --primary-bundle-id <bundle id> --notarize-app --username <username>


xcrun altool -t osx -f myApp.dmg --primary-bundle-id com.acme.myapp --notarize-app --username

You will be prompted for your Apple developer password (or you can include it on the command line).

You now have to wait a few minutes. If the upload is successful “No errors uploading ” will be shown and a unique ID will be returned. You then have to use this to request your upload be scanned:

xcrun altool --notarization-info <notarize ID> -u <username>


xcrun altool --notarization-info xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxx -u

You will be prompted for your Apple developer password (or you can include it on the command line).

Hopefully you will see “Status Message: Package Approved”. If the notarization fails, you should be sent a link to an online log file describing the issue. If the notarization completes successfully you need to ‘staple’ the results to your .dmg:

xcrun stapler staple -v <dmg file>


xcrun stapler staple -v myApp.dmg

The stapler outputs a log including some odd phrases. Mine included: “Humanity must endure”, “Let’s see how that works out. “, “Adding 1 blobs to superblob. What about Blob?” and “Enjoy”. Weird. Hopefully it will end with “The staple and validate action worked!”.

Finally you can unpack your .dmg into a .app and verify it with:

spctl -a -v <app file>


spctl -a -v /Applications/

On macOS 10.14 (but not earlier OSs) it should say “source=Notarized Developer ID”. Your software should now run on 10.14 without a warning dialog. Congratulations!

It all seems rather clumsy. As you have to wait asynchronously for the unique ID to be returned from step 1 before you can complete step 2, it is not easy to fully automate in a script. This is a major pain the arse. If anyone works out a way to automate it the whole process, please let me know.

Here are some links to the various posts that I gleaned this information from:

** Update 28-Apr-2023 **

altool is now deprecated. See Moving from altool to notarytool for Mac notarization for an update.

4 thoughts on “How to notarize your software on macOS

  1. Trygve

    How does the stapler know which notary results to use when you do this multiple times (perhaps for different versions of the same app or different apps)?

  2. Tony Gray

    Thanks – this helped a lot! One note: a lot of the command-line options in the examples require a double-dash, but they’re shown on this page as an em-dash (usually a side-effect of pasting double-dashes into a “smart” editor).

    1. Andy Brice Post author


      Thanks. I hadn’t spotted that it was mangling the hypens. I have now replaced ‘-‘ with ‘-’. It looks correct, but you can’t cut and paste it into a Mac shell. ‘‰’ is the same. Any idea what the correct HTML code is?

Comments are closed.