Signing and notarizing
Sign packages for every platform, sign Windows downloads with Authenticode and notarize Mac apps.
sign: identity: "Apple Development: you@example.com (ABCDE12345)" # signs the macOS app, else ad hoc profile: assets/AppStore.mobileprovision # signs the iOS, tvOS or watchOS stub IPA keystore: assets/release.p12 # signs APKs, with key_alias certificate: assets/codesign.pfx # signs the Windows app and its installer # watch_profile: assets/Watch.mobileprovision # signs <id>.watchkitapp inside a watch-only IPA (optional with a wildcard profile) # widgets_profile: assets/Widgets.mobileprovision # the iOS extension's profile; use a macOS profile for a Mac App Store build # share_profile: assets/Share.mobileprovision # signs the IPA's share extension # clip_profile: assets/Clip.mobileprovision # signs the IPA's App Clip # quicklook_profile: assets/QuickLook.provisionprofile # signs the Mac App Store QuickLook preview extension # quicklook_thumbnail_profile: assets/Thumbnail.provisionprofile # signs the Mac App Store QuickLook thumbnail extensionThe keystore’s passwords come from NSGO_KEYSTORE_PASSWORD and NSGO_KEY_PASSWORD. -team signs the iPhone’s package. -profile, -watch-profile, -widgets-profile, -share-profile, -clip-profile, -quicklook-profile, -quicklook-thumbnail-profile and -macos-profile replace the app’s, the watch app’s, the widget extension’s, the share extension’s, the App Clip’s, the Mac App Store QuickLook preview and thumbnail extensions’ and the Mac App Store’s provisioning profiles from the command line. -installer replaces the Mac Installer Distribution identity.
For -target watchos, nsgo build keeps the standalone <name>.app for -run device installs and writes <name>.ipa (copied to dist/releases as <slug>-<version>-watchos.ipa) containing Xcode’s watch-only iOS stub (ITSWatchOnlyContainer), the nested watchOS app (<id>.watchkitapp) and WatchKitSupport2/WK. For App Store Connect, set sign.profile for <id> and sign.watch_profile for <id>.watchkitapp from the same team (or a single wildcard sign.profile covering both); the build validates both profiles and signs inside-out.
Sign Windows packages
Section titled “Sign Windows packages”Authenticode identifies a Windows download’s publisher; SmartScreen checks its reputation separately. sign.certificate, a .pfx, signs the executable, the command companion, the programs and libraries the app’s resources bring, the installer with its uninstaller, and the MSIX built for the Store channel; its password comes from NSGO_CERTIFICATE_PASSWORD. The signatures are made in Go, as signtool makes them, so a Mac signs them without the Windows SDK:
sign: certificate: assets/codesign.pfx timestamp_url: http://timestamp.digicert.com # the RFC 3161 server that timestamps themsign.timestamp_url defaults to DigiCert’s, and none leaves the signatures untimestamped, which they lose at the certificate’s expiration. A certificate on a hardware token or in a cloud service signs through a command of its own instead, in which %1 is the file to sign and which the build runs for every file above:
sign: sign_command: "signtool sign /fd sha256 /tr http://timestamp.digicert.com /td sha256 /a %1"build stops if the command succeeds but leaves the app executable, command companion, a PE resource, or the setup executable without an embedded Authenticode signature.
The uninstaller inside the installer is signed before it is embedded, with the same sign.certificate or sign.sign_command as the app and the setup. -certificate, -sign-command and -timestamp-url set these from the command line.
Notarize
Section titled “Notarize”Apps downloaded on a Mac open without Gatekeeper’s warning once Apple has notarized them. Sign with a Developer ID and name the credentials notarytool keeps in your keychain:
xcrun notarytool store-credentials hello --apple-id you@example.com --team-id ABCDE12345sign: identity: "Developer ID Application: Example Inc (ABCDE12345)" notarize: hello # the keychain profile above; or -notarize hellobuild then signs with the hardened runtime, submits the disk image, waits for Apple’s verdict, a few minutes, and staples the ticket to the image and the app; a rejection prints Apple’s log. In CI, NSGO_NOTARY_KEY, NSGO_NOTARY_KEY_ID and NSGO_NOTARY_ISSUER, an App Store Connect API key’s .p8 file, ID and issuer, take the profile’s place. The hardened runtime denies the microphone, the camera, the calendars and location unless the app claims them, which build does when apple.info has NSMicrophoneUsageDescription, NSCameraUsageDescription, a calendars or reminders usage description, or a location usage description.