> ## 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.

# [macos]: the Mac build

> Every [macos], [macos.signing], [[macos.agents]] and [[macos.run]] setting, how choices map to macOS, removal behavior and what doesn't apply.

`[macos]` describes the Mac version of your app. `bach build` then writes a Setup app in a `.dmg` besides the Windows file. Name, version, publisher, texts, look, languages, choices and `[updates]` are shared. If the app only runs on Macs, leave `[files]` out. Walkthrough: [Ship for macOS](/docs/guides/macos.md).

```toml bach.toml theme={"theme":{"light":"github-light","dark":"github-dark"}}
[macos]
source = "app-macos"
executable = "Hello.app"
data = ["~/Library/Application Support/Hello"]
minimum_version = "12.0"
executables = ["Hello.app/Contents/MacOS/*"]   # needed when building on Windows

[[macos.agents]]
name = "sync"
file = "Hello.app/Contents/MacOS/hello-sync"
keep_alive = true

[macos.signing]
identity = "Developer ID Application: Example Inc. (ABCDE12345)"
notarize = "example-notary"
```

## Settings

| Setting | Default | Meaning |
| - | - | - |
| `source` | required | Folder with the Mac files. Symbolic links inside it are kept (links pointing outside are refused), permissions are kept, `.DS_Store` is skipped. |
| `executable` | `app.executable` | An app bundle (`Hello.app`) or program inside `source` |
| `exclude` | `files.exclude` | Patterns to leave out |
| `executables` | none | Patterns for files that must be executable, when permissions were lost (for example on Windows). Each must match a file. |
| `output` | `dist/{name}-Setup-{version}.dmg` | Ends in `.dmg` or `.zip`. Without a Mac, a `.zip` is written. |
| `data` | none | Folders removable with **Also delete my data**. Each starts with `~/` and has your app's own folder, for example in `~/Library/Application Support`, `Caches`, `Logs`, `Preferences` or `Containers`. Home, `~/Library`, key and mail folders and other programs' data are refused. |
| `icon` | none | `.icns` for the Setup app and uninstaller |
| `bundle_id` | `app.bach.setup.<id>` | The Setup app's identifier (the uninstaller's adds `.uninstall`) |
| `minimum_version` | none | Oldest macOS, such as `"12.0"`. Setup says what's needed on older Macs. |

## \[macos.signing]

Used with `bach build --sign`.

| Setting | Meaning |
| - | - |
| `identity` | Code signing identity. Default `"-"` (ad hoc). |
| `notarize` | A `notarytool` keychain profile; submits the `.dmg` and staples the result. Needs a Developer ID identity. |
| `installer_identity` | A "Developer ID Installer" identity for the `.pkg` |

## \[\[macos.agents]]

Background programs run by launchd, the Mac's version of services.

| Setting | Default | Meaning |
| - | - | - |
| `name` | required | Letters, digits, dashes |
| `file` | the app's program | Packaged program with execute permission |
| `arguments` | none | Not run through a shell |
| `run_at_load` | `true` | Start when loaded |
| `keep_alive` | `false` | Restart if it exits |
| `interval` | none | Run every N seconds (10 or more) |

## \[\[macos.run]]

Like [`[[run]]`](/docs/reference/config/run), for files with execute permission.

## How choices map

| Windows option | On a Mac |
| - | - |
| Start menu shortcut | link in Applications |
| Desktop shortcut | link on the Desktop |
| Start with Windows | launch agent, shown as **Open at login** |
| Add to PATH | a marked block in `~/.zprofile` (and `~/.bash_profile` if it exists) |
| Automatic updates | launch agent checking every four hours |

An app that is exactly one `.app` bundle goes straight into `~/Applications` (`/Applications` with `scope = "machine"`), and the window only asks to install. Anything more goes into `~/Applications/<installer.folder>`. Setup never runs as root.

## Removal

Users remove the app by moving it to the Trash. A background watcher then removes links, launch agents, the `PATH` block, the install record and the uninstaller, but never user data. The uninstaller is also at `~/Library/Application Support/Bach/uninstallers/<app id>/Uninstall <app>.app`; its `Contents/MacOS/bach-setup --silent --delete-data` removes app and data.

## For administrators

`Install <app>.app/Contents/MacOS/bach-setup --silent` with `--dir`, `--with`, `--without`, `--log` and `--uninstall`. `bach build --pkg` (on a Mac) writes a `.pkg` that installs into `/Applications`, without a window or choices, for MDM tools.

## Updates

The Mac file is listed in the feed under `arch.macos`. Add it to an existing feed with `bach feed <setup.exe> --macos <file.dmg>` or `bach build --feed-from latest.json`. With `updates.signer`, an update needs a Developer ID Application signature that Apple issued, with that name. `bach build --sign` stops when the certificate isn't one, and a Mac build without `--sign` warns. See [Protect your updates](/docs/guides/update-security.md#on-a-mac).

## Not used on Mac

`[[registry]]`, `[[env]]`, `[[context_menu]]`, `[[migrate]]`, `[[services]]`, `[[firewall]]`, `[[requirements]]`, `[[shortcuts]]`, `[[protocols]]`, `[[file_types]]`, `[signing]`, the online installer, MSI, winget, Chocolatey, Intune and patches. Declare link types and file types in your app's `Info.plist`.


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