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

# Environment variables read by Bach and its install scripts

> Every environment variable Bach reads: BACH_RUNTIME, BACH_RELEASES, BACH_NO_DOWNLOAD, BACH_NO_UPDATE_CHECK, BACH_UPDATE_FROM, BACH_INSTALL_DIR, BACH_VERSION, BACH_NO_PATH and BACH_PREVIEW_DIR.

Bach reads a few environment variables. Most matter only in CI or on machines that cannot reach GitHub. This page lists them, grouped by what reads them.

## The bach command

| Variable | Meaning |
| - | - |
| `BACH_RUNTIME` | Path of the `bach-setup.exe` to build on. Same as `--runtime`. |
| `BACH_NO_DOWNLOAD` | If set, `bach` never downloads the runtime. If it is not next to `bach`, the build stops and asks you to pass `--runtime` or set `BACH_RUNTIME`. |
| `BACH_SIGN` | If set to `1` (or `true`), `bach build` signs the setup files with the program [`[signing]`](/docs/reference/config/signing) names, like `--sign`. Without a `[signing]` section the build fails. |
| `BACH_STRICT` | If set to `1` (or `true`), `bach check` and `bach build` treat a warning as an error, like `--strict`. For CI. |
| `BACH_RUNTIME_ARM64` | Path of the ARM64 `bach-setup.exe` that `[arch.arm64]` builds on. Same as `bach build --runtime-arm64`. See [`[arch.arm64]`](/docs/reference/config/arch). |
| `BACH_FEED_KEY` | The private key (the content of the file `bach feed-key` wrote) that `bach build` and `bach feed` sign the update feed with. See [Signed feeds](/docs/guides/updates.md#signed-feeds). |
| `BACH_FEED_KEY_FILE` | The path of a file that holds that private key, instead of its content in `BACH_FEED_KEY`. |
| `BACH_BINARY_PATH` | Read by the `bach` command from npm (`@usebach/cli`): the native program to start instead of the one in the platform package. Useful for testing a build. |
| `BACH_RELEASES` | Where releases are downloaded from. Default `https://github.com/usebach/bach/releases/download`. A fork can point it elsewhere. It must start with `https://`; anything else is refused. |
| `BACH_NO_UPDATE_CHECK` | If set to any value, `bach` doesn't look for a newer release and never shows the "new version available" line. The line is also off when `CI` is set, with `--json`, and when standard error isn't a terminal. `bach update` still works. See [`bach update`](/docs/reference/cli/update). |
| `BACH_UPDATE_FROM` | For tests: a folder holding the release files (`bach-<version>-windows-x64.zip` or `bach-<version>-<os>-<arch>.tar.gz`, each with its `.sha256`). `bach update VERSION` installs from there instead of GitHub and never contacts it. The checksum is checked as always. |
| `BACH_RUNTIME_SHA256` | Read when `bach` is compiled, not when it runs: the SHA-256 of the `bach-setup.exe` that belongs to this build. The release scripts set it, so a released `bach` accepts only that runtime. A `bach` built from source has none. |

The runtime download is saved to a cache: `%LOCALAPPDATA%\bach\runtime\<version>` on Windows, and `$XDG_CACHE_HOME/bach/runtime/<version>` (or `~/.cache/bach/runtime/<version>`) elsewhere. It is created for its owner only on macOS and Linux, and it is hashed again before every use. A released `bach` checks the hash built into it. A `bach` built from source checks the `.sha256` published next to the file, which only catches a damaged download. With no `LOCALAPPDATA` (Windows), or neither `XDG_CACHE_HOME` nor `HOME` (elsewhere), there is no cache and no fallback to the shared temp folder: pass `--runtime` or set `BACH_RUNTIME`. Downloads use https only, redirects included.

## The install scripts

| Variable | Used by | Meaning |
| - | - | - |
| `BACH_VERSION` | `install.ps1`, `install.sh`, the GitHub Action | The version to install: `0.2.0` for exactly that one, `0.2` or `0` for the newest of that line (never `0.20` for `0.2`), `latest` for the newest. Default: the latest release. |
| `GITHUB_TOKEN` | `install.ps1`, `install.sh` | If set, used to look releases up, which keeps GitHub's rate limit for anonymous requests out of the way on shared CI machines. The GitHub Action sets it. |
| `BACH_INSTALL_DIR` | `install.ps1`, `install.sh` | Where to install. Default `%LOCALAPPDATA%\Programs\bach-cli` on Windows and `~/.local/bin` on macOS and Linux. |
| `BACH_NO_PATH` | `install.ps1` | If set, the script does not add the folder to your `PATH` (useful in CI) |
| `BACH_SCOPE` | `install.ps1`, `install.sh` | `user` (default) installs for you and never asks for administrator rights. `system` installs for every user: to `%ProgramFiles%\bach-cli` and the machine `PATH` on Windows, after Windows' own permission prompt; to `/usr/local/bin` on macOS and Linux, using `sudo` only if the folder isn't writable. If permission is refused, the script installs for you alone. `install.sh` also takes `--system` and `--user`. |
| `BACH_INSTALL_FROM` | `install.ps1`, `install.sh` | For tests: a folder holding the release files (`bach-<version>-windows-x64.zip` or `bach-<version>-<os>-<arch>.tar.gz`, each with its `.sha256`). The script installs from there instead of downloading, for exactly the `BACH_VERSION` given, and never contacts GitHub. The checksum is checked as always. Bach's CI uses it to test both scripts. |

`install.ps1` refuses a folder that holds files it did not put there. Set `BACH_INSTALL_DIR` to an empty folder in that case.

## The installer window

| Variable | Meaning |
| - | - |
| `BACH_PREVIEW_DIR` | In `--preview`, the install path the window shows. It exists so documentation screenshots do not show whose computer took them. |
| `BACH_ACCESS_KEY` | The access key for a setup file with [`[access]`](/docs/reference/config/access), for a silent install or to skip the key page. Update runs set it for the setup file they start. An app can name another variable with `access.key_env`, which only the build reads. |

See [Install Bach](/docs/installation.md) and [Automate in CI](/docs/guides/ci.md).


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