Product: macOS, Notarization Tool: notarytool, Stapler Tool: xcrun stapler, Application: master-billing.app, DMG: master-billing.dmg
I'm attempting to notarize and staple a macOS .dmg file containing a signed .app. Notarization completes successfully, but the stapling step fails with Error 65. All tools are up-to-date and I'm following the official Apple process.
#!/bin/bash set -e
APP="dist/mac-arm64/master-billing.app" DMG="dist/mac-arm64/master-billing.dmg" IDENTITY="Developer ID Application: NAME (TEAM ID)" PROFILE="notarysiva" VOLUME_NAME="MasterBilling"
Sign binaries and frameworks
find "$APP" -type f ( -name ".dylib" -or -name ".so" -or -name "*.node" -or -perm -u+x )
-exec codesign --force --options runtime --timestamp --sign "$IDENTITY" {} ;
find "$APP" -type d ( -name ".app" -or -name ".framework" )
-exec codesign --force --options runtime --timestamp --sign "$IDENTITY" {} ;
codesign --deep --force --options runtime --timestamp
--sign "$IDENTITY" "$APP"
Create DMG
hdiutil create -volname "$VOLUME_NAME" -srcfolder "$APP" -ov -format UDZO "$DMG"
Sign DMG
codesign --sign "$IDENTITY" --timestamp "$DMG"
Verify DMG signature
codesign --verify --verbose=2 "$DMG"
Submit for notarization
xcrun notarytool submit "$DMG" --keychain-profile "$PROFILE" --wait
Staple ticket
xcrun stapler staple -v "$DMG"
Signing all binaries, dylibs, and frameworks...
.
.
✅ App signing complete.
💽 Creating DMG...
......................................................................................
created: /Users/one/Documents/MASTER/bill-master/dist/mac-arm64/master-billing.dmg
🔏 Signing the DMG...
✅ Verifying DMG signature...
dist/mac-arm64/master-billing.dmg: valid on disk
dist/mac-arm64/master-billing.dmg: satisfies its Designated Requirement
📤 Submitting DMG for notarization...
Conducting pre-submission checks for master-billing.dmg and initiating connection to the Apple notary service...
Submission ID received
id: 32927c3c-7459-42b4-a90c
Upload progress: 100.00% (123 MB of 123 MB)
Successfully uploaded file
id: 32927c3c-7459-42b4-a90c
path: /Users/one/Documents/MASTER/bill-master/dist/mac-arm64/master-billing.dmg
Waiting for processing to complete.
Current status: Accepted............
Processing complete
id: 32927c3c-7459-42b4-a90c
status: Accepted
📌 Stapling notarization ticket to DMG... Processing: /Users/one/Documents/MASTER/bill-master/dist/mac-arm64/master-billing.dmg . . . Downloaded ticket has been stored at file:///var/folders/1l/ht34h5y11mv3rhv8dlxy_g4c0000gp/T/5bb9e667-dfe1-4390-8354-56ced7f48fa0.ticket. Could not validate ticket for /Users/one/Documents/MASTER/bill-master/dist/mac-arm64/master-billing.dmg The staple and validate action failed! Error 65.
See Resolving Error 65 When Stapling.
Share and Enjoy
—
Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"