A release build is signed, but notarization still depends on someone running commands by hand.
Fastest fix: for software distributed outside the Mac App Store, automate Apple’s notarytool submission and stapler workflow in macOS CI—but verify signing prerequisites, protect credentials, and test the final package before release.
This guide is for independent macOS developers turning manual notarization into a repeatable release process.
It also covers CI/CD engineers handling signing credentials and small teams checking that delivered installers contain the right notarization ticket.
Decide the distribution path before configuring macOS app notarization CI automation
For apps distributed outside the Mac App Store, Apple’s notarization workflow can be part of CI. Mac App Store distribution follows its own submission and review process; do not copy the outside-store workflow as though notarization were the same as App Review. Apple describes notarization as an automated check for software distributed outside the store, not as a replacement for review: Apple’s macOS notarization overview.
This boundary changes the release pipeline:
- Direct distribution: Build, sign with a Developer ID identity, submit the software for notarization, inspect the result, staple the ticket where supported, and verify the package users will download.
- Mac App Store distribution: Follow the App Store submission workflow. The store handles distribution through its own channel; do not add an independent notarization step simply because the app is a macOS app.
- Multiple channels: Keep separate release jobs or clearly separated conditions. A build intended for direct download and a build submitted to the store may have different packaging and validation requirements.
The common mistake is to make “notarization passed” the release condition without confirming which artifact was submitted. CI can notarize a valid intermediate archive while the uploaded installer is stale, rebuilt, or packaged differently. The release gate must apply to the actual deliverable.
Prepare the signed artifact before the first submission
Apple notarization does not repair a defective signature. Treat signing and packaging as prerequisites, then add notarization to the release path.
For direct distribution, check these items before the CI job submits anything:
- The app is signed with a suitable Developer ID identity. Confirm that the signing identity is available to the build job and that the signature verifies after packaging.
- The app uses Hardened Runtime where required for the distribution path. Add only the entitlements the app actually needs; do not copy a broad entitlement set from a different target. Apple explains the runtime controls in its Hardened Runtime documentation.
- The signature includes a secure timestamp. Apple’s distribution preparation guidance describes signing and timestamp requirements; check the settings for the actual target rather than treating a particular Xcode version or project template as universal. See Apple’s distribution preparation guidance.
- The submitted object is the intended deliverable or an appropriate container. An app bundle, disk image, and installer package are not interchangeable during packaging or validation. Apple’s macOS packaging guide covers distribution packaging options.
For example, a release script may invoke codesign with runtime and timestamp options. The exact identity, entitlements, and packaging command depend on the app. We should not turn a sample command into a universal build recipe: frameworks, helpers, login items, and nested code can require target-specific signing decisions.
A useful preflight is to make the build fail before notarization if signature verification fails. Check the app bundle after the final signing operation, not only an earlier build product. If the app is modified after signing—by replacing a nested binary, rewriting resources, or changing the bundle—the signature may no longer describe the artifact being submitted.
A successful notarization result applies to the submitted software. If CI changes or repackages the app afterward, verify the new deliverable instead of assuming it inherited the earlier result.
First, store notarytool credentials without putting them in the workflow
notarytool supports authentication using an App Store Connect API key or an Apple Account with an app-specific password and team information. For automation, choose one supported method, limit access to the credentials, and keep secret values out of workflow source and logs. Apple documents the command-line workflow and authentication options in its custom notarization workflow reference.
A practical CI design separates secret storage from the command that consumes the secret:
- Save the required credential material as protected CI secrets. Store an API private key as a secret rather than committing the key file to the repository.
- Make credentials available only to the release job that needs them. In GitHub Actions, repository, organization, and environment secrets have different scopes; use the narrowest scope that fits the team. The GitHub Actions secrets guide explains how workflows access secrets.
- Pass secret values through the runner environment or a temporary file with restricted permissions. Do not print them, include them in command-line debug output, or write them into a tracked file.
- Use environment protection rules where a release needs approval or restricted access. GitHub documents environment-based protection in its deployment environments guide.
- Remove temporary key files and signing material when the job finishes. On a persistent self-hosted runner, also check what remains in the user keychain, workspace, and temporary directory after a failed or cancelled job.
In GitHub Actions, a release job can pass a secret API key into a shell step, write the key to a temporary file, and call notarytool with the key ID and issuer information. Alternatively, credentials can be stored as a keychain profile and referenced by name. Keep the workflow file limited to secret references and commands; never paste the actual password, private key, or full credential into YAML.
Protect the trigger as carefully as the secret itself. A workflow that runs for an untrusted pull request must not receive release credentials. GitHub warns that workflow events and untrusted code can create security risks; its secure-use guidance covers the relevant boundaries. In particular, do not expose signing or notarization secrets to arbitrary external contributions. Review the separate security guidance for pull_request_target before using that event: a privileged workflow must not check out and run untrusted pull-request code.
The goal is not just to hide a password. It is to ensure that code which cannot be trusted cannot use the identity that signs and releases the app.
Next, submit the package, wait for a result, and staple the ticket
A repeatable job follows the same release sequence each time:
- Build the release configuration and sign the app and its nested code.
- Create the distribution object that will be submitted. Keep a record of the file path and checksum so later steps refer to the same build output.
- Submit that object with
notarytool. For a job that must not continue until processing finishes, use the wait option, such asxcrun notarytool submit "$ARTIFACT" --keychain-profile "$PROFILE" --wait. - Capture the submission identifier and final status. If processing fails or returns a result that needs review, stop the release job and inspect the log before retrying.
- Staple the ticket to a supported target, then validate the stapled object.
- Rebuild the final distribution container if necessary, and test the exact file intended for publication.
The command shown is an example of the keychain-profile authentication route; a CI job using API key flags directly will pass the corresponding key information instead. Keep credentials outside the command text where possible, and avoid enabling shell tracing around secret-bearing steps.
The ticket-stapling step depends on the file type. Apple’s stapler tool can staple tickets to supported distribution items such as an app bundle, disk image, or installer package. A ZIP archive itself is not a stapling target. For a ZIP containing an app, staple the app first, validate it, then create the ZIP that will be distributed. For a disk image or installer package, staple and validate the relevant final item. Apple’s notarization instructions describe the submission flow, while its packaging documentation explains the distribution formats.
A minimal shell outline might look like this:
set -euo pipefail
xcrun notarytool submit "$ARTIFACT" \
--keychain-profile "$NOTARY_PROFILE" \
--wait
xcrun stapler staple "$STAPLE_TARGET"
xcrun stapler validate "$STAPLE_TARGET"
Set ARTIFACT and STAPLE_TARGET from the packaging stage, not from loosely matched filenames. For ZIP distribution, the submission archive and staple target are different: submit the archive as required by the chosen workflow, staple the enclosed app, and then create the final ZIP from that stapled app. Never point stapler at the ZIP and treat a failed command as a harmless warning.
Make the notarization log and final download part of the release gate
A green build status is not enough. The pipeline should stop when notarization is rejected, and it should preserve enough diagnostic output for an engineer to investigate without leaking secrets.
When notarytool returns a submission identifier, use it to retrieve the processing log if the status is unsuccessful or requires investigation. Apple’s common notarization issues reference is useful for interpreting failures. Review the log for the specific binary, signing, entitlement, or packaging issue it identifies. Do not treat a warning as proof that every target in a complex app is correctly signed.
Separate outcomes in the workflow:
- Accepted: Continue only after the expected submission has completed successfully.
- Rejected: Fail the release. Retrieve the log, fix the identified issue, rebuild, sign again, and submit the resulting artifact.
- Warnings or unexpected status: Route the build to review instead of silently publishing. Determine whether the warning affects the app’s actual distribution path.
Then test the final download, not just the submitted intermediate file. Check that the stapled item validates, that the disk image or package opens as intended, and that installation works on a clean test system. If the final deliverable is a ZIP, test the archive users will download and confirm that it contains the stapled app. Apple’s distribution guidance covers testing software prepared for release; the point for CI is to make those checks refer to the same artifact that will be published.
Use this release checklist as an enforceable gate:
- [ ] The job is for direct distribution, not a store-submission job copied from another workflow.
- [ ] The app is signed with the intended Developer ID identity and the signature verifies after packaging.
- [ ] Hardened Runtime settings and entitlements match the app’s actual requirements.
- [ ] The notarization credentials are available only to the trusted release job.
- [ ] The job records the submission result and fails on rejection.
- [ ] The ticket is stapled to a supported target; a ZIP is not passed directly to
stapler. - [ ] The exact package intended for publication passes validation and installation checks.
- [ ] Temporary credentials and signing material are removed or securely isolated after the job.
Choose a runner that fits the release process
A GitHub-hosted macOS runner and a persistent Mac build host solve different operational problems. A hosted runner may suit a release pipeline that installs its toolchain, imports signing material for one job, builds, and exits. A persistent Mac can suit teams that need a stable, remotely accessible environment for repeated builds, interactive diagnosis, or controlled maintenance. Neither choice removes the need to protect credentials or test the released artifact.
| Build environment | Advantages | Trade-offs | Better fit |
|---|---|---|---|
| Ephemeral hosted macOS runner | Clean job environment; less host maintenance for the team | Tool setup repeats; investigation after a job may be less convenient; secrets still need strict workflow controls | Release jobs that can recreate their environment from scripts |
| Persistent self-hosted Mac | Easier access to a maintained build environment and interactive diagnosis | Team owns patching, account and keychain hygiene, runner isolation, and cleanup after failed jobs | Teams that need a continuing Mac environment and can operate it securely |
| Remote Mac used for CI and manual release work | Provides a remotely managed macOS environment without requiring each engineer to use a local Mac | Requires clear ownership of access, updates, signing credentials, and release procedures | Teams that value remote access and need a Mac for more than a single short-lived job |
Before choosing, write down who can access the signing identity, who patches the host, how the team recovers from a failed release, and whether the build can be recreated from source. A self-hosted runner that accepts untrusted jobs is not a safe shortcut. GitHub’s guidance on secure Actions use should inform the runner and workflow design.
Teams reviewing remote access can also check BerryVM’s data privacy information and data center details as part of their operational assessment. These pages are relevant to evaluating where remote work happens and how access is handled; they do not replace a team’s own review of credential storage and runner permissions.
If the current setup is a Linux build host or a developer’s local machine, the trade-offs are concrete: Linux cannot run the macOS signing and notarization toolchain, while a local Mac can be unavailable during builds and may mix personal and release credentials. Buying and maintaining a dedicated Mac avoids shared-host scheduling but adds hardware ownership and upkeep. For temporary releases, test environments, or a team that needs remote macOS access without buying a machine, renting a Mac can be a more flexible fit. It is not the right choice for every workload: teams with continuous heavy builds, strict physical-device connections, or a need to control hardware maintenance directly may prefer an owned host. Start by matching the environment to the release schedule and security model, then use BerryVM’s remote Mac and CI guides to assess whether a remotely managed Mac fits the workflow.
Automate Your macOS Release Pipeline with BerryVM
Run your self-hosted CI runner on a dedicated physical Mac mini with a full macOS environment.
