---
name: configure-mac-notarization
description: Signs a SwiftPM Mac bundle, submits it for notarization, and staples the ticket so Gatekeeper can accept it. Use when the user wants notarization outside Xcode, a hardened runtime, or a stapled ticket.
license: MIT
metadata:
  category: apps
  tags: "macos,desktop"
  author: johnny-bravo
  version: "1.0"
  updated: "2026-11-09"
  status: published
  aliases: "macos-spm-app-packaging, notarytool, stapler, Gatekeeper"
  source_url: "https://github.com/Dimillian/Skills/tree/05ba982bfeb0d77d3c97d4542b0ee15034d05f84/macos-spm-app-packaging"
  source_license: MIT
  copyright: "Copyright (c) 2026 Thomas Ricouard"
  original_author: "Thomas Ricouard (Dimillian/Skills, macos-spm-app-packaging)"
  modified: "Adapted by TheSkillVault: rewritten as a short sign-and-notarize pass (bundle id, hardened runtime, notarytool, staple, Gatekeeper); dropped the bootstrap script catalogue and Sparkle appcast. Independent how-to, not Apple or vendor documentation. Nothing was signed or submitted for this library."
  imported_on: "2026-11-09"
---

# Configure Mac notarization

A SwiftPM Mac product still needs a signed bundle and a notarization ticket, or Gatekeeper will not trust a download. Xcode is not required for that path.

## When to use
- The project is SwiftPM and has no Xcode project for signing.
- Gatekeeper rejects a download of the bundle.
- A notarization upload was rejected as a duplicate version.

## When not to use
- The need is a WinUI page or an MSIX. Those are separate skills.
- The product is an iOS phone binary. This is the Mac bundle path.
- The person only wants a SwiftUI layout. That is a separate skill.

## Steps
1. Keep Package.swift, a bundle id, and a version file. If notarization says the upload already exists, bump the build number and pack again.
2. Assemble the bundle with the project's package script. Confirm the binary sits inside Contents/MacOS and is executable.
3. Sign every binary with the hardened runtime option (`--options runtime`). Keep only entitlements Apple allows. Drop the rest.
4. Submit with `xcrun notarytool`. Keep the store-account credential outside the repo. Do not paste it into a script.
5. Staple the ticket onto the bundle. If staple fails just after a successful notarization, wait briefly and staple again.
6. Ask Gatekeeper to assess the bundle (`spctl --assess`). A local pass is not a store submission.

## Gotchas
- Do not include passwords, tokens, or the notarization credential in the repo or in sample output.
- A missing hardened-runtime option is a common notarization failure. Add it on every sign call.
- Sparkle update feeds are optional. Skip them unless the project already uses Sparkle, and still bump the build number for each upload.
- This is an independent how-to adapted from Thomas Ricouard's skill. It is not Apple documentation. Nothing was signed, notarized, stapled, or submitted for this library.

## Portability
If you use Xcode, keep the hardened runtime, notarization, and staple steps inside its archive flow. If you use SwiftPM, follow the script path above. Either way the credential stays outside the repo.

## Done when
- The bundle contains its binary, and signing uses the hardened runtime.
- The notarization credential is not in the repo.
- The ticket is stapled, and Gatekeeper was asked to assess the bundle.

## Example prompt
"Notarize this SwiftPM Mac bundle outside Xcode. Use the hardened runtime, staple the ticket, and do not submit it to the store."

---
Adapted from "macos-spm-app-packaging" by Thomas Ricouard in Dimillian/Skills (MIT, Copyright (c) 2026 Thomas Ricouard). See LICENSE.txt.
