Skip to content

Instantly share code, notes, and snippets.

Created March 12, 2022 13:08
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
What would you like to do?
Proper notarization of macOS apps since Xcode 13+
# this script must be ran in the same directory as the .app file!
# change this
APP_NAME="Sonic Time"
# must be a 'Developer ID: ' cert, not Mac Distribution etc...
# this is the name of a notarytool profile, you have to make it ONCE with this command:
# xcrun notarytool store-credentials "Profile_Name" --apple-id "your apple id email here" --team-id YourTeamIDHere --password PasswordOrAppPassword
# the fun
rm -rf _export
mkdir _export
mkdir "_export/$PRODUCT_NAME"
security unlock-keychain -p "$MAC_USER_PASS"
# almost like a poem
codesign --verbose --deep --strict --timestamp --force --options=runtime --sign "$CERT_NAME" "$APP_NAME"
mv "$APP_NAME" "_export/$PRODUCT_NAME"
cd _export
hdiutil create -srcfolder "$PRODUCT_NAME" -format UDBZ notaryfiles.dmg
xcrun notarytool submit -p "$NOTARY_PROFILE" --verbose notaryfiles.dmg --wait --timeout 2h
xcrun stapler staple "$APP_NAME"
cd ..
rm notaryfiles.dmg
hdiutil create -srcfolder "$PRODUCT_NAME" -format UDBZ FINAL.dmg
echo "please see FINAL.dmg, thank you."
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment