SPB Git

Repository Public

notarization.md 4.2 KB

# Notarization

Source: Scripts/notarize.sh. It runs after Scripts/release.sh (signing.md) and needs a notarytool keychain profile that already exists on the maintainer's Mac.

# Rules the script follows

  • It never creates, prints or changes credentials. The profile name comes from NOTARY_PROFILE (default MacLustr-Notarize), created beforehand with xcrun notarytool store-credentials.
  • A submission counts as successful only when Apple's answer has the status Accepted. Any other status, or a refused upload, stops the script with a message that says exactly what is and is not notarized.
  • The words "notarized by Apple" are printed only at the very end, after both submissions were accepted and both tickets stapled.

# Steps

Step Commands On failure
1. Submit the application ditto -c -k --keepParent "dist/ORIX Docs.app" build/notary/app.zip, then xcrun notarytool submit … --wait --output-format json; the answer is saved to build/notary/app.json, the notary log to build/notary/app-log.json Exit 2: "NOT notarized. … is signed but carries no notarization ticket."
2. Staple the application xcrun stapler staple, xcrun stapler validate Script stops (set -e)
3. ZIP of the stapled application ditto -c -k --keepParent → dist/ORIX-Docs-<version>.zip
4. Disk image Scripts/package.sh builds dist/ORIX-Docs-<version>.dmg (distribution.md); it is signed (codesign --force --timestamp), submitted like the application, then stapled and validated Exit 3: "the app is notarized and stapled, the DMG is NOT."
5. Gatekeeper and checksums spctl --assess --type execute on the application; spctl --assess --type open --context context:primary-signature on the disk image; shasum -a 256 of both artifacts into dist/SHA256SUMS.txt; everything gathered into dist/release.json

The ZIP is created from the application after stapling, so the application inside it carries its ticket. A ZIP archive itself cannot be stapled.

# Recorded result for version 1.0.0 (build 2)

From dist/release.json. The dist/ folder is ignored by git, so the facts are reproduced here.

Item Submission id Status
Application (ORIX Docs.app) 5cbffb9c-d031-4702-81c6-ecb0d1068eca Accepted
Disk image (ORIX-Docs-1.0.0.dmg) 794c8ee7-f0ef-491f-b7cc-7ab911771eca Accepted

Gatekeeper output recorded in the same file:

text
dist/ORIX Docs.app: accepted
  source=Notarized Developer ID

dist/ORIX-Docs-1.0.0.dmg: accepted
  source=Notarized Developer ID

Stapling: the script only reaches the step that writes dist/release.json after stapler staple and stapler validate succeeded for both items. xcrun stapler validate "dist/ORIX Docs.app" was run again on 2026-11-21 while writing this document and answered "The validate action worked!".

# Checking a submission again

The maintainer can ask Apple for the status or the log of a submission with the same profile:

sh
xcrun notarytool info 5cbffb9c-d031-4702-81c6-ecb0d1068eca --keychain-profile "$NOTARY_PROFILE"
xcrun notarytool log  794c8ee7-f0ef-491f-b7cc-7ab911771eca --keychain-profile "$NOTARY_PROFILE"

Anyone can check the result without credentials:

sh
xcrun stapler validate "/Applications/ORIX Docs.app"
spctl --assess --type execute --verbose=2 "/Applications/ORIX Docs.app"
spctl --assess --type open --context context:primary-signature --verbose=2 ORIX-Docs-1.0.0.dmg

# What is not covered

  • The notary logs (build/notary/*-log.json) are build products and are not committed; their content is not reproduced here.
  • The first launch of a downloaded, quarantined copy was not exercised on a clean second Mac (distribution.md). The Gatekeeper assessments above were made on the build machine.
  • Notarization is Apple's automated check of the signed code. It is not a review of the application's behaviour.
Files main
Menu

Theme