Notarization and distribution
Local, development and Developer ID builds, notarized and stapled, with SwiftPM or Xcode.
xcrun notarytool store-credentials notary
swift package --allow-writing-to-package-directory --allow-network-connections all \
cef bundle --product MyApp --sign "Developer ID Application: Example Corp (A1B2C3D4E5)" \
--notarize --keychain-profile notary
Distribution
Local builds (ad hoc)
-
swift package … cef bundle --product MyApp. With no identity in the keychain, the bundle is signed ad hoc, without the hardened runtime. - Runs on the Mac that built it. Gatekeeper refuses it on another Mac.
-
.automaticsafe storage uses a mock keychain; Chromium passkeys offer security keys and, with thebluetoothcapability, phones. - To test the hardened runtime and the entitlements locally, bundle with
--hardened-runtime; unrestricted entitlements apply ad hoc.
Development builds (Apple Development)
- An Apple Development certificate in the login keychain (Xcode,
Settings > Accounts > Manage Certificates).
cef bundlepicks it up without--sign. - For restricted entitlements, a macOS App Development profile that
lists this Mac, set as
provisioningProfile. - The hardened runtime is on and
get-task-allowlets a debugger attach. The app runs on the Mac that built it and on the devices the profile lists; Gatekeeper refuses it when downloaded. -
.automaticsafe storage uses the login keychain: macOS asks once for “Safe Storage”, and Always Allow lasts across rebuilds.
Distribution builds (Developer ID, notarized)
-
A Developer ID Application certificate (only the team’s Account Holder can create one).
-
A Developer ID provisioning profile when the app claims restricted entitlements (for iCloud Keychain passkeys).
-
Store notary credentials once:
xcrun notarytool store-credentials notary(an app-specific password, or an App Store Connect API key). -
Bundle, notarize and staple:
swift package --allow-writing-to-package-directory --allow-network-connections all \ cef bundle --product MyApp --sign "Developer ID Application: Example Corp (A1B2C3D4E5)" \ --notarize --keychain-profile notaryThis signs with the hardened runtime and a secure timestamp, zips the app with
ditto, submits it withxcrun notarytool submit --wait, prints the notary log when Apple rejects it, staples the ticket to the app withxcrun stapler staple, and zips the stapled app again (a zip cannot carry a ticket of its own). With--package dmgit wraps the app in a disk image signed with the same identity and staples the disk image instead; see SwiftPM’s plugin sandbox for where that runs. This path follows Apple’s notarization documentation and has not been run against Apple’s service. -
swift package … cef doctor dist/MyApp.appreports no errors, andspctl --assess --type execute -vv dist/MyApp.appprintssource=Notarized Developer ID. -
For Widevine, with
"protectedMedia"incapabilities: the Browser example’sbrowser://playground/widevine.htmlplays and says “Playing with com.widevine.alpha”. (Not yet run with a team signature.)
With Xcode
Signing with a team, archiving and exporting are Xcode’s, as for any app; the build phase signs the parts inside with the archive’s identity. Not yet run with a team signature or against Apple’s notary service:
- Choose the team in Signing & Capabilities; remove
RUNTIME_EXCEPTION_DISABLE_LIBRARY_VALIDATIONif the target has it. - Product › Archive (
xcodebuild archive -scheme MyApp -archivePath MyApp.xcarchive). - Organizer › Distribute App › Direct Distribution, which exports with
the Developer ID identity, notarizes and staples; or
xcodebuild -exportArchive -archivePath MyApp.xcarchive -exportPath out -exportOptionsPlist options.plistwithmethoddeveloper-id, thenswift package … cef notarize out/MyApp.app --keychain-profile notary(orxcrun notarytool submitandxcrun stapler stapleyourself). Xcode’s export signs the app again with the Developer ID identity and a secure timestamp, nested code first; whether it re-signs the helper apps inContents/Frameworksitself is unverified, so check the result. -
cefswift doctor out/MyApp.app(the tool the phase built, in$(OBJROOT)/CefSwift) orswift package … cef doctorfrom a package reports no errors, andspctl --assess --type execute -vv out/MyApp.appprintssource=Notarized Developer ID.
Without a team, Examples/Xcode/ExportOptions.plist (method
mac-application) exports the archived app as it is signed, ad hoc; it
runs on the Mac that built it. Mac App Store distribution is not possible:
see App Sandbox.
SwiftPM’s plugin sandbox
swift package runs the plugin in a sandbox. Inside it:
codesignandsecuritysee the keychains of the search list (the login keychain), not other keychain files:--keychainwith a file outside the search list fails with “no identity found”.hdiutilcannot create disk images, so--format dmgfails;zipworks.spctlcannot assess apps (see cef doctor).- Whether
notarytoolreaches its keychain profile and Apple’s service from inside the sandbox has not been tested.
Where a step fails for this reason, the plugin’s message says so; run the
command it prints in Terminal, or pass --disable-sandbox to
swift package, which turns the sandbox off for the whole run.