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

# bach build

> bach build writes the setup file. All flags: output path, platform, profiles, signing, patches, online installer, MSI, ARM64, version and more.

`bach build` packs your build folder and settings into a setup file. If your `bach.toml` describes Windows and macOS, it builds both.

```bash theme={"theme":{"light":"github-light","dark":"github-dark"}}
bach build
bach build path/to/bach.toml --out dist/MySetup.exe
bach build --app-version v1.4.0 --sign
```

## Flags

| Argument or flag | Meaning |
| - | - |
| `CONFIG` | The config file, default `bach.toml` |
| `-o`, `--out PATH` | Write the setup file here instead of `installer.output`. Only for a single output file. |
| `--app-version VERSION` | Use this version instead of `app.version` (a leading `v` is dropped) |
| `--fast` | Compress quickly, for testing |
| `--strict` | Stop before writing anything if there's a warning. Also `BACH_STRICT=1`. |
| `--platform NAME` | `windows`, `macos` or `all` (default: every platform in the config) |
| `--profile NAME` | Build a [profile](/docs/reference/config/profiles.md); repeat for several |
| `--all-profiles` | The main build and every profile (not with `--profile`) |
| `--sign` | Sign with [`[signing]`](/docs/reference/config/signing). Also `BACH_SIGN=1`. Error without `[signing]`. |
| `--online` | Also write the [online installer](/docs/guides/other-builds.md#online-installer) (needs `[updates]`) |
| `--patch-from FILE` | An earlier setup file; also write an [update patch](/docs/guides/patches-and-rollouts.md#make-updates-smaller-with-patches) |
| `--msi` | Also write an [MSI](/docs/guides/msi.md) |
| `--key-file FILE` | Access keys, one per line, for apps with [`[access]`](/docs/reference/config/access) |
| `--runtime PATH` | The `bach-setup.exe` to build on. Also `BACH_RUNTIME`. |
| `--runtime-arm64 PATH` | ARM64 `bach-setup.exe` for [`[arch.arm64]`](/docs/reference/config/arch). Also `BACH_RUNTIME_ARM64`. |
| `--x64-only` | Skip the ARM64 build |
| `--runtime-macos PATH` | The Mac setup program. Also `BACH_RUNTIME_MACOS`. |
| `--pkg` | Also write a macOS `.pkg` (needs a Mac) |
| `--feed-from FILE` | Add the Mac file to a `latest.json` another build job wrote |

## Output

```text theme={"theme":{"light":"github-light","dark":"github-dark"}}
Building Hello Notes 1.0.0
  Publisher    Your Name
  ...
Wrote dist\Hello Notes-Setup-1.0.0.exe (9.3 MB)
  Packed       1.5 KB of 4.0 KB (38%), in 0.6s
```

Depending on your settings it also writes:

* `latest.json`, with [`[updates]`](/docs/reference/config/updates) (when it knows the download address)
* `<name>-Web-Setup.exe`, the online installer
* `<name>-Setup-<version>-patch-from-<old>.exe`, with `--patch-from`
* component downloads (`.bachpack`)
* the `-arm64.exe` file, ZIPs for zip profiles, the `.msi`, and the Mac files

## Notes

* If the build fails, an existing setup file is left as it was.
* Replacing a setup file that's open or running fails with a message to close it.
* Sign after building, never before. With `--sign`, Bach does it in the right order.
* On macOS and Linux, the Windows setup file keeps Bach's icon. Build on Windows to apply `app.icon`.
* A [`[macos]`](/docs/reference/config/macos) build writes `dist/{name}-Setup-{version}.dmg`, or a `.zip` on a computer that can't make one.
* The same input produces the same file, byte for byte, except with signing or access keys.


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