Skip to content

Shipping the Mac Component

Maintainer runbook for building, signing, notarizing, and verifying Barn’s native macOS release payload.

Only maintainers cutting a Barn release need this page: it builds, signs, notarizes, and verifies the native macOS payload (the CLI, barn-hosts-helper, and Barn.app) inside barn_VERSION_darwin_arm64.tar.gz. To build Barn.app for your own use, see Build from Source; for the overall release order, see release gates.

Payload and signing order

packaging/mac-release.py build produces the payload: MACOS.md, MACOS.json, bin/barn, bin/barn-hosts-helper, and bin/Barn.app. MACOS.json records the version, source commit, file modes, digests, and signing state; the version and commit must match the GoReleaser archives the payload joins.

The app’s bundle identifier is com.pgsty.barn and its executable is barn-mac-runner. The CLI checks the runner’s versioned protocol and still recognizes the v0.9.0 bundle, Barn Mac.app (io.pgsty.barn.mac-runner). Replacing the app keeps VM state under $BARN_HOME/mac.

Because the CLI embeds the helper’s SHA-256, the payload builder signs in this order and the archive verifiers reject any other result:

  1. Build and sign barn-hosts-helper.
  2. Build barn with the signed helper’s SHA-256 embedded, then sign the CLI.
  3. Sign Barn.app with hardened runtime and a secure timestamp.
  4. Submit the CLI, helper, and app to Apple together for notarization. After acceptance, staple the app, validate its ticket, and check Gatekeeper.
  5. Export the payload, extract it again, and recheck the signatures and the stapled ticket.
  6. During release assembly, replace the CLI and helper in the Darwin arm64 archive with these exact signed bytes, and regenerate its SPDX document and the checksums.

Signing the helper again after the CLI is built changes its digest and breaks the pair.

Build a formal release locally

Use this path when the tag workflow has no signing secrets, or to produce release assets on a maintainer’s Mac.

  1. Prepare the Mac. You need Apple Silicon with macOS 27+ and Xcode 27+, the toolchain pinned in packaging/toolchain.env, and goreleaser, syft, rpm, ruby, bsdtar, jq, and python3 on PATH. Find your Developer ID Application identity with security find-identity -v -p codesigning, and store a notarization profile with xcrun notarytool store-credentials. Keep certificate private keys and passwords outside the repository.

  2. Check out the release tag. release-local requires HEAD at tag v<version>, a clean working tree and index with no untracked files, and an origin remote.

  3. Synchronize the catalog if it changed. The formal payload build and release-local both run make catalog-check first and stop on any mismatch; see Maintain the image catalog.

  4. Build the signed payload and assemble the release into a new directory outside the source tree:

    export BARN_CODESIGN_IDENTITY='Developer ID Application: your organization (TEAMID)'
    export BARN_NOTARY_PROFILE=barn-release
    export BARN_MAC_REQUIRE_NOTARIZATION=1
    VERSION="${RELEASE_VERSION:?Set RELEASE_VERSION to the checked-out release tag version}"
    COMMIT="$(git rev-parse HEAD)"
    export SOURCE_DATE_EPOCH="$(git show -s --format=%ct HEAD)"
    export BARN_BUILD_DATE="$(date -u -r "$SOURCE_DATE_EPOCH" +%Y-%m-%dT%H:%M:%SZ)"
    RELEASE_DIR="$(mktemp -d "${TMPDIR:-/tmp}/barn-release.XXXXXX")"
    
    python3 packaging/mac-release.py build \
      "$VERSION" "$COMMIT" "$SOURCE_DATE_EPOCH" "$RELEASE_DIR/native.tar.gz"
    BARN_MAC_PAYLOAD="$RELEASE_DIR/native.tar.gz" \
      make release-local VERSION="$VERSION" OUTPUT="$RELEASE_DIR/assets"
    VariableEffect
    BARN_CODESIGN_IDENTITYDeveloper ID identity used to sign the helper, CLI, and app; unset means ad-hoc signing
    BARN_NOTARY_PROFILEStored notarytool profile; the payload is submitted to Apple for notarization
    BARN_MAC_REQUIRE_NOTARIZATION=1Fails the build unless it is Developer ID signed and notarized; mac-release.py build also runs the catalog gate first
  5. Check the output. release-local accepts only a Developer ID signed, notarized payload built from the same commit, so a snapshot or uncommitted payload fails here. It verifies archives, packages, SBOMs, checksums, and CLI/helper pairing, and writes the assets to $RELEASE_DIR/assets. Continue with acceptance.

Test packaging with a snapshot

In a checkout based on a stable release tag, use the same version helper as CI to select the next patch snapshot (for example, 1.4.1-next after v1.4.0). The packaging check compares the native payload’s version and commit. A dirty checkout uses uncommitted as the commit identifier.

set -e
source packaging/semver.sh
snapshot_tag=$(git describe --tags --abbrev=0 --match 'v[0-9]*')
snapshot_version=$(barn_next_snapshot_version "${snapshot_tag#v}")
snapshot_commit=$(git rev-parse HEAD)
if [ -n "$(git status --porcelain --untracked-files=normal)" ]; then
  snapshot_commit=uncommitted
fi
snapshot_epoch=$(git show -s --format=%ct HEAD)
snapshot_dir=$(mktemp -d "${TMPDIR:-/tmp}/barn-snapshot.XXXXXX")

python3 packaging/mac-release.py build \
  "$snapshot_version" "$snapshot_commit" "$snapshot_epoch" "$snapshot_dir/native.tar.gz"
BARN_MAC_PAYLOAD="$snapshot_dir/native.tar.gz" SOURCE_DATE_EPOCH="$snapshot_epoch" make release-snapshot

Snapshots accept ad-hoc signatures; only formal release verification requires a notarized Developer ID payload.

Configure automated signing

The tag workflow uses these six repository secrets:

SecretValue
MAC_CERTIFICATE_BASE64Base64-encoded Developer ID Application .p12, including the private key
MAC_CERTIFICATE_PASSWORDPassword protecting the .p12
MAC_CODESIGN_IDENTITYImported identity name or certificate fingerprint
MAC_NOTARY_KEY_BASE64Base64-encoded App Store Connect API .p8 key
MAC_NOTARY_KEY_IDAPI key identifier
MAC_NOTARY_ISSUERAPI issuer identifier
Secrets configuredTag workflow behavior
NoneSkips automatic release creation; use the local path
SomeFails immediately
All sixBuilds, signs, and notarizes the payload; any failure blocks release assembly

The Mac workflow imports the signing material into an ephemeral runner keychain and removes it when the job ends; pull requests and snapshots use ad-hoc builds. The release workflow creates the draft release only after verifying the assembled payload.

Verify installation and publish

  1. Run the gates: make check, make mac-native-test, and a full snapshot with the native payload.

  2. Test installation in an isolated directory: first install, repeat install, and upgrade.

  3. Run live acceptance on a supported physical Mac with the packaged app. Check startup, SSH, the desktop window, and normal shutdown; replacing the app must keep instance IDs, machine IDs, SSH keys, and host pins. The harness automates this:

    ARGS=(--barn /absolute/path/to/barn --home /absolute/disposable-home --output /absolute/new-evidence-dir)
    python3 tests/mac-live-acceptance.py "${ARGS[@]}" --plan
    python3 tests/mac-live-acceptance.py "${ARGS[@]}" --allow-test-root --gui
    OptionMeaning
    --barnAbsolute path to the packaged barn
    --homeDedicated, disposable BARN_HOME; mac1 is recreated and destroyed
    --outputNew or empty evidence directory, separate from --home
    --allow-test-rootRequired the first time; marks --home as a destructive test root
    --planPrint the phases without running Barn or touching files
    --guiAdd desktop and clipboard checks
    --allow-downloadLet up download macOS from Apple (about 26 GB) when no base is prepared

    A failed run keeps the VM state and the evidence. When testing SSH integration, isolate the process’s home directory as well as BARN_HOME, because the managed ~/.ssh/config entries live outside the VM state root.

  4. Sign and publish the draft. Stage the verified assets in the tag workflow or local draft. Sign the checksum manifest and upload release.json, checksums.txt and checksums.txt.sig together. make release-publish RELEASE_TAG=v<version> verifies the staged inventory and digests before publication. Signing steps

  5. Update Homebrew. Release assembly generates barn.rb from packaging/homebrew/barn.rb.tmpl, which installs barn into bin and the helper and app into libexec; keep its install and test logic aligned with the tap. Once the assets are public, update all four platform URLs and checksums. Versions with a suffix keep an explicit version line, because Homebrew may otherwise infer 64 from the architecture suffix; plain versions omit it.

  6. Verify the public release. Install from the public archives, the installer, and a Homebrew upgrade against the released bytes, and record signing, notarization, VM acceptance, and public installation results separately in Validation History.

Table reader