It fails:
Code Block bash-3.2$ spctl -a -t open --context context:primary-signature -v MyApp.dmg MyApp: rejected source=no usable signature
However this DMG installs fine on Big Sur 11.2.2, macOS allows to run this app, and checking of notarization for installed app was passed:
Code Block bash-3.2$ spctl -a -v '/Applications/MyApp.app' /Applications/MyApp.app: accepted source=Notarized Developer ID
I checked other downloaded apps (Intel or Universal). Some DMG files pass DMG notarization (for example, Audacity), and some fails (PerfectTablePlan). Why?
For my app (Universal) I use the following code to codesign and notarize:
Code Block codesign --timestamp --options runtime --force --deep -s "Developer ID Application: MYCOMPANY" "My.app" // Creating DMG with EULA license xcrun altool --notarize-app --primary-bundle-id MyApp -u "my@email.com" -p "abc123" --file MyApp.dmg xcrun stapler staple MyApp.dmg
My general advice is that you start with these two docs:
They describe the process as a whole. If you find anything there unclear, I’d be happy to clarify that here.
Coming back to your specific questions:
Like "notary tool doesn't require a signed DMG" - well OK but does Gatekeeper not require a signed DMG?
It does not.
Why does the Apple example of customising the Xcode archive process make no mention of Stapling anything - not in the document nor in the sample script?
That is a weird omission. I suspect that it’s an artefact of history [1]. Regardless, I encourage you to file a bug requesting that we correct that omission.
Please post your bug number, just for the record.
is stapling something that is optional
Stapling is optional, although recommended for the reasons described in Packaging Mac software for distribution. Notarisation Resources has a link to a DevForums post, The Pros and Cons of Stapling, that explains this trade-off in more detail.
Similarly the sample script doesn't code sign the DMG file - why not ?
Probably because it’s not required.
Surely the sample script should produce a DMG file that is ready for distribution?
It does, albeit one that values simplicity of thoroughness. I think it’d be reasonable for you to request a fix for that as part of your bug report.
Share and Enjoy
—
Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"
[1] You can’t staple until notarisation is complete, and historically there was no good way to wait for that. That changed when we moved from altool
to notarytool
. The example in Customizing the Xcode archive process was updated to use the new --wait
flag, but not updated for the knock-on effects of that flag.