# ed machines env

> ed machines env compares the environment of two project shells you choose, for example your local checkout and the same project on a build machine.

- Canonical URL: https://getedith.pro/docs/cli/machines-env
- Updated: 2026-12-02

`ed machines env` compares the environment of two project shells you choose,
for example your local checkout and the same project on a build machine. Each
shell is saved by piping its own environment into Edith, so variables that a
per-directory loader already set are included. Edith only reads the piped text
and never sources `.envrc`, `.env` or any other project script.

```
cd ~/code/api && env -0 | ed machines env capture local-api
ed machines exec box -- 'cd ~/code/api && env' | ed machines env capture box-api --directory ~/code/api
ed machines env diff local-api box-api
ed machines env diff local-api box-api --values --json
ed machines env export local-api box-api --output ~/Desktop/api-env.md
ed machines env rm box-api --yes
```

A remote capture through `ed machines exec` runs a non-interactive shell, so it
reflects the machine's shell startup files but not hooks that only run at an
interactive prompt. Both `env -0` and plain `env` output are accepted.

## Commands

| Command | What it does |
| --- | --- |
| `capture <name> [--allow <pattern>]... [--directory <path>]` | Reads environment text from stdin, at most 1 MiB, and saves it under the name. The directory recorded is `--directory` or your working directory. Saving an existing name replaces it. |
| `ls` | Lists saved shells with their name counts, capture time and directory. |
| `diff <base> <compare> [--values] [--all]` | Compares allowlisted names. Values print as `hidden` unless `--values` is passed. `--all` includes names whose values match. |
| `export <base> <compare> [--format markdown\|json] [--output <file>]` | Writes a names-only report to stdout or to a new file. Existing files are never replaced. |
| `rm <name> [--yes]` | Previews, then forgets a saved shell with `--yes`. |

`capture`, `ls`, `diff` and `rm` accept `--json`. Names use 1 to 64 letters,
digits, dots, dashes or underscores.

## What is kept

Only allowlisted names are saved. The default allowlist covers paths and
toolchain variables such as `PATH`, `JAVA_HOME` and `VIRTUAL_ENV`, runtime
settings such as `NODE_ENV`, `PORT` and `RAILS_ENV`, and prefixes such as
`NODE_*`, `PYTHON*`, `AWS_*`, `VITE_*` and `TF_VAR_*`. Add a name, or a prefix
ending in `*`, with `--allow`. Everything else is counted as not allowlisted and
is not stored.

A name is sensitive when it contains words such as `TOKEN`, `SECRET`,
`PASSWORD`, `KEY` or `AUTH`, or when its value looks like a credential to the
same rules share review uses, such as a URL with a password. A sensitive value
is never written to disk, and saved shells are checked again when they load, so
a diff reports a sensitive name as present and withheld, never as equal or
different. A diff only compares names that both shells allowlisted.

Saved shells live in the machines data folder under `environments`, one file
per shell, readable only by you.

## Output

`capture --json` returns
`{name,directory,capturedAt,names,sensitive,notAllowlisted,replaced}`, and
`ls --json` returns an array of the same summaries without `replaced`.

`diff --json` returns `{base,compare,valuesShown,differences}`. Each difference
is `{name,change,sensitive}`, plus `base` and `compare` values only with
`--values` and only for names that are not sensitive. `change` is `added` (only
in compare), `removed` (only in base), `changed`, `withheld` (sensitive in both)
or `unchanged`.

`export` never includes values or directories. Its JSON is
`{format,valuesIncluded,base,compare,counts,names}` with `valuesIncluded`
always `false`. The Markdown report lists differing names in a table and counts
the matching ones.

Invalid names, patterns or arguments exit 2, an unknown saved shell exits 3,
and other failures, such as an existing export file, exit 1.

## In the app

Open a machine's **Tools** tab. **Environment diff** lists the saved shells and
shows the commands that capture this Mac and that machine. Pick a base and a
compare shell, turn on **Show safe values** to see values that are not
sensitive, and copy or save the names-only report.

## Where to go next

- [`ed machines`](https://getedith.pro/docs/cli/machines)
- [All `ed` commands](https://getedith.pro/docs/cli)

## Get Edith

Edith is a native Mac app for macOS 14 or later on Apple silicon with 100+ extensions, the `ed` command line and an MCP server. $35 once for one Mac, plus $7 for each additional Mac, with no subscription and a 30-day refund.

- [Buy Edith](https://getedith.pro/pricing): $35 once for one Mac, plus $7 for each additional Mac
- [Download Edith](https://getedith.pro/download): the installer, or Homebrew
