Use when adding new error messages to React, or seeing "unknown error code" warnings.
npx skills add eovidiu/agents-skills --skill "macos-cicd-distributor"
Install specific skill from multi-skill repository
# Description
macOS app signing, notarization, and distribution expert. Guides developers through code signing with Developer ID, hardened runtime, notarization with notarytool, packaging as DMG/PKG/ZIP, and distribution via App Store, TestFlight, or direct download. Includes CI/CD automation for GitHub Actions and Xcode Cloud. Use when preparing a macOS app for release, debugging signing errors, setting up notarization pipelines, or troubleshooting Gatekeeper rejections.
# SKILL.md
name: macos-cicd-distributor
description: macOS app signing, notarization, and distribution expert. Guides developers through code signing with Developer ID, hardened runtime, notarization with notarytool, packaging as DMG/PKG/ZIP, and distribution via App Store, TestFlight, or direct download. Includes CI/CD automation for GitHub Actions and Xcode Cloud. Use when preparing a macOS app for release, debugging signing errors, setting up notarization pipelines, or troubleshooting Gatekeeper rejections.
macOS Signing, Notarization & Distribution
Overview
Code signing, notarization, and distribution are the most error-prone part of shipping macOS apps. This skill provides battle-tested workflows, scripts, and templates that eliminate guesswork and prevent the common pitfalls that waste hours of developer time.
Use this skill when preparing a macOS app for release, debugging signing or Gatekeeper errors, setting up CI/CD pipelines, or choosing distribution strategies.
Core Workflow
Every macOS app distribution follows this pipeline:
Build β Sign β Package β Notarize β Staple β Distribute
Each step has specific tools, requirements, and failure modes. This skill covers all of them.
Decision Trees
Which Distribution Channel?
Is this for the Mac App Store?
ββ YES β Apple Distribution cert + App Sandbox + Xcode Upload/Transporter
β Reference: references/distribution-channels.md
ββ NO β
Is this for beta testers?
ββ YES β TestFlight for Mac (still requires notarization)
β Reference: references/distribution-channels.md
ββ NO β
Is this for enterprise/internal use?
ββ YES β Developer ID + PKG + deploy via MDM (JAMF/Munki)
β Reference: references/distribution-channels.md
ββ NO β
Direct download from website or GitHub?
ββ YES β Developer ID + DMG or ZIP + notarize + staple
Reference: references/packaging.md
Which Package Format?
Does the app need install scripts, LaunchDaemons, or system components?
ββ YES β PKG installer (pkgbuild + productbuild)
β Reference: references/packaging.md
ββ NO β
Is this a consumer app (drag-to-Applications)?
ββ YES β DMG (hdiutil)
β Reference: references/packaging.md
ββ NO β
GitHub Releases or automated web download?
ββ YES β ZIP (ditto, NEVER /usr/bin/zip)
β Staple the .app BEFORE zipping
ββ NO β DMG
What Certificate Do I Need?
| Distribution | Certificate | Sandbox Required? |
|---|---|---|
| Mac App Store | Apple Distribution | Yes |
| Direct download | Developer ID Application | No (hardened runtime required) |
| PKG installer | Developer ID Installer | No |
| Development/testing | Apple Development | No |
End-to-End Workflows
Developer ID (Direct Distribution)
The most common workflow for apps distributed outside the App Store:
# 0. Verify signing identity exists
security find-identity -v -p codesigning
# 1. Build archive
xcodebuild -scheme "MyApp" -configuration Release \
-archivePath build/MyApp.xcarchive archive
# 2. Export with Developer ID signing
xcodebuild -exportArchive \
-archivePath build/MyApp.xcarchive \
-exportPath build/export \
-exportOptionsPlist ExportOptions-DeveloperID.plist
# 3. Verify signature
codesign --verify --verbose=4 build/export/MyApp.app
codesign --display --entitlements :- build/export/MyApp.app
# 4. Create DMG
hdiutil create -volname "MyApp" \
-srcfolder build/export/MyApp.app \
-ov -format UDZO build/MyApp.dmg
# 5. Notarize (blocks until complete, typically 5-15 min)
xcrun notarytool submit build/MyApp.dmg \
--keychain-profile "notary-profile" --wait
# 6. Staple the notarization ticket
xcrun stapler staple build/MyApp.dmg
# 7. Final verification
xcrun stapler validate build/MyApp.dmg
spctl -a -vvv -t install build/MyApp.dmg
Template: assets/templates/ExportOptions-DeveloperID.plist
Script: scripts/sign-and-notarize.sh (automated version)
Mac App Store
# 1. Archive
xcodebuild -scheme "MyApp" -configuration Release \
-archivePath build/MyApp.xcarchive archive
# 2. Export for App Store
xcodebuild -exportArchive \
-archivePath build/MyApp.xcarchive \
-exportPath build/export \
-exportOptionsPlist ExportOptions-AppStore.plist
# 3. Upload via Transporter CLI or Xcode
xcrun altool --upload-app -f build/export/MyApp.pkg \
-t macos --apiKey KEY_ID --apiIssuer ISSUER_ID
# Or use Xcode: Organizer β Distribute App β App Store Connect
Template: assets/templates/ExportOptions-AppStore.plist
Template: assets/templates/Entitlements-Sandbox.entitlements
Quick Start
First-Time Setup
- Get certificates from Apple Developer Portal
- Store notarization credentials:
bash xcrun notarytool store-credentials "notary-profile" \ --apple-id "[email protected]" \ --team-id "TEAMID" \ --password "xxxx-xxxx-xxxx-xxxx" - Copy templates into your project:
assets/templates/ExportOptions-DeveloperID.plistassets/templates/Entitlements-HardenedRuntime.entitlements- Use the automation script:
bash bash scripts/sign-and-notarize.sh build/export/MyApp.app
CI/CD Setup
- Export your .p12 certificate and encode as base64
- Create App Store Connect API key (preferred over Apple ID in CI)
- Copy the GitHub Actions template:
assets/templates/github-actions-release.yml- Set up CI keychain:
bash bash scripts/setup-keychain-ci.sh
Reference: references/ci-cd-automation.md
When to Use This Skill
Trigger this skill when:
- Preparing a macOS app for first release
- Setting up code signing certificates
- Debugging "damaged app" or Gatekeeper errors
- Creating or fixing notarization pipelines
- Choosing between DMG, PKG, or ZIP
- Setting up GitHub Actions / Xcode Cloud for macOS
- Migrating from altool to notarytool
- Troubleshooting CI signing identity issues
- Preparing for Mac App Store submission
- Adding hardened runtime or entitlements
- Understanding macOS Sequoia security changes
Quick Reference: Verification Commands
| What | Command |
|---|---|
| List signing identities | security find-identity -v -p codesigning |
| Verify app signature | codesign --verify --verbose=4 MyApp.app |
| Show entitlements | codesign --display --entitlements :- MyApp.app |
| Gatekeeper check (app) | spctl -a -t exec -vv MyApp.app |
| Gatekeeper check (pkg) | spctl -a -vvv -t install MyInstaller.pkg |
| Verify PKG signature | pkgutil --check-signature MyInstaller.pkg |
| Validate staple | xcrun stapler validate MyApp.dmg |
| Check quarantine attr | xattr -l MyApp.app \| grep quarantine |
| Remove quarantine | xattr -cr MyApp.app |
| Validate plist | plutil -lint MyApp.entitlements |
| Notarization log | xcrun notarytool log <id> --keychain-profile "profile" |
| Notarization history | xcrun notarytool history --keychain-profile "profile" |
Resources
references/
Comprehensive documentation loaded as needed:
code-signing.md- Certificates, codesign flags, deep signing, hardened runtime, entitlementsnotarization.md- notarytool workflow, auth methods, rejection debugging, staplingpackaging.md- DMG, PKG, ZIP creation and when to use eachdistribution-channels.md- App Store, Developer ID, TestFlight, enterprisetroubleshooting.md- Common errors, Gatekeeper, Sequoia changesci-cd-automation.md- GitHub Actions, Xcode Cloud, Fastlane, CI keychain
scripts/
Ready-to-use automation:
sign-and-notarize.sh- End-to-end: sign β DMG β notarize β stapleverify-distribution.sh- Run all verification checks with pass/fail reportsetup-keychain-ci.sh- CI keychain creation, cert import, partition list
assets/templates/
Copy-paste templates:
ExportOptions-DeveloperID.plist- xcodebuild export for Developer IDExportOptions-AppStore.plist- xcodebuild export for App StoreEntitlements-HardenedRuntime.entitlements- Minimal hardened runtimeEntitlements-Sandbox.entitlements- App Sandbox for App StoreDistribution.xml- productbuild distribution descriptorgithub-actions-release.yml- Complete signing + notarization CI pipeline
Summary
Shipping macOS apps requires getting every step right. A single misstep in signing, entitlements, or packaging produces cryptic errors that are hard to diagnose.
This skill eliminates guesswork:
- Decision trees tell you which path to take
- Scripts automate the error-prone steps
- Templates give you correct starting points
- Troubleshooting guides diagnose what went wrong
Build it. Sign it. Ship it.
# Supported AI Coding Agents
This skill is compatible with the SKILL.md standard and works with all major AI coding agents:
Learn more about the SKILL.md standard and how to use these skills with your preferred AI coding agent.