Skip to content
Latchkey

mise: Environment Variables and Directory env

mise sets project environment variables through the [env] table in mise.toml.

mise is also a direnv-style environment manager. The [env] table sets variables that apply when you are in the project, including loading values from a .env file.

What it does

The [env] table in mise.toml defines environment variables for the project. A special "_.file" entry loads a dotenv file, and "_.path" prepends directories to PATH. mise env prints the resolved variables (use --shell to emit shell-specific export lines). When mise is activated, these variables apply automatically in the directory.

Common usage

mise.toml / Terminal
# mise.toml
[env]
APP_ENV = "ci"
DATABASE_URL = "postgres://localhost/app"
_.file = ".env"
_.path = ["./bin"]

# print resolved env vars
mise env
# export them into the current shell
eval "$(mise env -s bash)"

Syntax

Key / commandWhat it does
[env]Table of environment variables for the project
_.file = ".env"Load variables from a dotenv file
_.path = ["./bin"]Prepend directories to PATH
mise envPrint the resolved environment
mise env -s bashEmit shell export lines to eval
mise exec -- <cmd>Run a command with the env and tools applied

In CI

Use [env] to keep non-secret project config in the repo while injecting secrets through the runner environment. In a step that is not under mise activation, run commands via mise exec -- so the [env] and tools apply, or eval mise env to export them first.

Common errors in CI

Variables that are empty in a CI step usually mean mise is not activated there; use mise exec -- or eval "$(mise env -s bash)". A missing dotenv file referenced by _.file can fail the load; confirm the path relative to mise.toml. Do not commit secrets into [env]; keep them in runner secrets and reference them at runtime.

Related guides

Run this faster and cheaper on Latchkey managed runners. Start free →