> ## Documentation Index
> Fetch the complete documentation index at: /docs/llms.txt
> Use this file to discover all available pages before exploring further.

> ## Agent Instructions
> Bach builds Windows installers from one bach.toml with the bach command: bach init, bach check, bach preview, bach build. Installs are per user and need no administrator rights by default. installer.scope = "machine" installs for every user after one Windows prompt. On Windows, run setup files with Start-Process -Wait -PassThru in PowerShell, and give signtool arguments that start with the word sign.

# Ship for macOS

> Build a Mac Setup app in a .dmg from the same bach.toml, test it, sign and notarize it, deploy it to many Macs and release it from GitHub Actions.

Bach can build a Mac version of your installer from the same `bach.toml`: a Setup app inside a `.dmg` with the same window as on Windows. This guide takes you from your Mac app to a file Mac users can open.

You need your app already built for macOS, usually as an app bundle such as `Hello.app`.

## 1. Add a \[macos] section

```toml bach.toml theme={"theme":{"light":"github-light","dark":"github-dark"}}
[macos]
source = "app-macos"                 # a folder containing Hello.app
executable = "Hello.app"
data = ["~/Library/Application Support/Hello"]
```

Your name, version, publisher, texts, look, choices and updates are shared with the Windows build. Windows-only settings, such as registry values, services, requirements and extra shortcuts, don't apply to the Mac build. See [`[macos]`](/docs/reference/config/macos).

```bash theme={"theme":{"light":"github-light","dark":"github-dark"}}
bach check
```

This now lists both builds.

## 2. Build

```bash theme={"theme":{"light":"github-light","dark":"github-dark"}}
bach build --platform macos
```

This writes `dist/Hello-Setup-1.0.0.dmg`. Making a `.dmg` needs a Mac; on Windows or Linux you get a `.zip` of the Setup app instead. Without `--platform`, `bach build` builds every platform in `bach.toml`.

If your Mac files come from a computer that doesn't keep Unix file permissions, such as a Windows checkout, list the programs in `executables`.

## 3. Try it on a Mac

Open the `.dmg` and double-click **Install Hello**.

If your app is a single app bundle, it goes straight into `~/Applications` and the window only asks you to click **Install**. To remove it, move it to the Trash. Bach then cleans up what it added (links, background agents and its install record) and keeps your user data.

On a Mac, `bach preview` shows the Mac window.

## Sign and notarize

Without signing, macOS asks users to confirm before opening your app the first time. Removing that prompt needs the Apple Developer Program (99 US dollars a year):

1. Create a **Developer ID Application** certificate and keep it in your keychain.
2. Save your notarization login once: `xcrun notarytool store-credentials example-notary`.
3. Add:

```toml bach.toml theme={"theme":{"light":"github-light","dark":"github-dark"}}
[macos.signing]
identity = "Developer ID Application: Example Inc. (ABCDE12345)"
notarize = "example-notary"
```

```bash theme={"theme":{"light":"github-light","dark":"github-dark"}}
bach build --platform macos --sign
```

Bach signs the app and the `.dmg`, sends it to Apple for notarization and attaches the result. This must run on a Mac.

## Many Macs at once

Administrators can install without a window:

```bash theme={"theme":{"light":"github-light","dark":"github-dark"}}
"Install Hello.app/Contents/MacOS/bach-setup" --silent
```

`--dir`, `--with`, `--without`, `--log`, `--uninstall` and the exit codes work like [on Windows](/docs/guides/silent-installs.md).

For management tools such as Jamf, Intune, Kandji or Munki, build an installer package:

```bash theme={"theme":{"light":"github-light","dark":"github-dark"}}
bach build --platform macos --pkg
```

The `.pkg` installs into `/Applications` for every user. To sign it, add a **Developer ID Installer** certificate as `installer_identity` and use `--sign`.

## Updates

One `latest.json` serves Windows and Mac. A Mac only downloads the Mac entry, checks it, and runs the Setup app without a window. Build both platforms in one run so the feed lists both. See [Where to host updates](/docs/guides/update-hosting.md#arm64-and-macos-in-the-same-feed).

## Release from GitHub

Add a Mac build to the [release workflow](/docs/guides/releasing.md):

```bash theme={"theme":{"light":"github-light","dark":"github-dark"}}
bach workflow --macos
```

A second job on a Mac builds the Setup app after the Windows release and adds it to the same release and feed. Without secrets, the app is signed "ad hoc" (not for distribution without the confirmation prompt). To sign and notarize, add `[macos.signing]` with `notarize = "bach-notary"` and these repository secrets:

| Secret | Contains |
| - | - |
| `MACOS_CERTIFICATE` | Your Developer ID Application certificate (`.p12`), base64 encoded |
| `MACOS_CERTIFICATE_PASSWORD` | Its password |
| `APPLE_API_KEY` | An App Store Connect API key (`.p8`), base64 encoded |
| `APPLE_API_KEY_ID` | The key's id |
| `APPLE_API_ISSUER` | Your App Store Connect issuer id |


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.