« MBS Xojo Plugins for … | Home | MBS Xojo Plugins, ver… »

Notarize script

Let me show you a sample script on how to easily notarize a disk image automatically. The script is pretty generic, so you only change the path to go to on the beginning and the pattern to find the dmg file. We use ls command here to find it independent of the version number. And as you see, we pack our archives into a temp folder:

#!/bin/bash

cd /private/tmp/Release/

# find the file based on filename pattern
Name=$(ls MBS*.dmg)

echo "Notarize $Name ..."

# notarize it
xcrun notarytool submit $Name --progress --apple-id xxx@monkeybreadsoftware.de \
--password xxxx-xxxx-xxxx-xxxx --team-id RZXXXXXXXB --wait

if [ "$?" != "0" ]; then
    echo "Notarize failed" 1>&2
    exit 1
fi

# attach notarization receipt
xcrun stapler staple $Name

if [ "$?" != "0" ]; then
    echo "Stapler failed" 1>&2
    exit 1
fi

# verify it worked
spctl -a -v -t install $Name

if [ "$?" != "0" ]; then
    echo "Check failed" 1>&2
    exit 1
fi

# open folder in Finder
open .

As you see we use the newer notarytool to submit to Apple. Please use your own email there and the app specific password (created on the appleid website). The update will run and if it fails for some reason, we continue with the next step and attach the receipt to the dmg. Then we verify it and open the folder in Finder to show it.

I hope this is useful for some of you uploading notarized applications.

The biggest plugin in space...
15 06 23 - 16:03