Skip to main content
The env commands manage the env variables stored on a profile. They are stored encrypted and injected into every VM created with machine0 new --profile <name> — written to /etc/environment (services and non-login shells) and /etc/profile.d/machine0-env.sh (interactive sessions). Commands target the current profile; pass -p/--profile to target another one. The whole group is also available as machine0 vars (its pre-1.0.146 name), kept for backward compatibility.

env ls

List a profile’s variables. Secret values render masked.

env set

Set env variables in a profile (KEY=VALUE, space-separated, values may contain =). Aliased as env add.
Secret variables — pass --secret to mark every key in that invocation as secret. Secret values are write-only: env ls and profiles get (including --json) show them as ******** (secret) and no API read ever returns them again — they stay readable only inside a VM (e.g. in /etc/environment). Key names and their existence remain visible, as for any variable. Details:
  • Re-setting a key without --secret un-marks it (the new value displays in cleartext); re-setting with --secret keeps it masked.
  • Masked env ls --json output is not round-trippable: piping it back into env set is rejected (it would overwrite the real value with the placeholder). The literal ******** can never be stored as a variable value.
  • Variables set before this feature existed aren’t retroactively masked — re-set them with --secret to mark them.
A variable named ANTHROPIC_API_KEY or OPENAI_API_KEY competes with a connected claude-code or codex integration on the same profile: the VM ends up holding both credentials, and which one the agent uses depends on the provider’s own precedence rules. Pick one mechanism per provider. MACHINE0_API_KEY and MACHINE0_MCP_URL are auto-populated on profiled VMs with the profile’s MCP gateway endpoint and a matching API key. Setting either name yourself disables injection of both (the two only make sense as a pair), and your values are used instead. When changes apply — variables are written when a VM boots (at creation and on resume from suspend) and whenever the profile is re-applied to a running VM with profiles deploy. Outside those events, a running VM does not pick up env set/unset changes. Profiles hold up to 100 variables (64KB serialized); keys are [A-Za-z_][A-Za-z0-9_]*, values up to 4096 characters of printable ASCII: no newlines, tabs, double quotes, or non-ASCII characters such as em dashes and emoji (non-ASCII breaks VM provisioning).

env unset

Remove env variables from a profile by key. Aliased as env rm. A key that isn’t set in the target profile is an error and nothing is removed — this catches typos (and a profile name passed as a key) before a deletion lands on the wrong target. Removal asks for confirmation naming the profile — secret values are write-only, so a removed secret can’t be recovered; pass --yes to skip the prompt (required in scripts).