Skip to content

Cookbook & Power-User Tricks

Short, copy-pasteable recipes for the things you’ll reach for daily. Each one links to the page where the concept is taught in full — this page is the cheat sheet, not the tutorial.

The 30-second per-project baseline: tools, env, and one task. Drop it in, mise install, go.

mise.toml
[tools]
node = "22"
python = "3.13"
[env]
_.file = ".env" # load dotenv if present
DATABASE_URL = { default = "postgres://localhost/dev_db" }
[tasks.dev]
run = "npm run dev"
description = "Start the dev server"

Why: this single file replaces an .nvmrc, an .envrc, and a make dev. Commit it, gitignore mise.local.toml. See Tools and Environments.

Run any tool at any version without touching mise.toml — mise installs it on the fly and throws it away after.

Terminal window
mise x node@22 -- node --version
mise exec python@3.12 go@1.23 -- ./build.sh # multiple tools at once

Why: perfect for one-off scripts and quick checks. mise x is the alias for mise exec. See Install & Activate.

Non-interactive contexts never run your shell rc, so mise activate was never wired up. Use mise exec (or shims) to make tools resolve anyway.

crontab / systemd ExecStart
# crontab: full path to mise, exec the tool from the project dir
*/5 * * * * cd /srv/app && /home/deploy/.local/bin/mise exec -- node cron-job.js
myapp.service
[Service]
WorkingDirectory=/srv/app
ExecStart=/home/deploy/.local/bin/mise exec -- node server.js

Why: mise exec reads the project’s mise.toml and sets up PATH/env for that one command — no activation, no login shell. The alternative is putting ~/.local/share/mise/shims on PATH. See CI, Docker & IDEs.

Let mise create and activate the project virtualenv whenever you enter the directory.

mise.toml
[tools]
python = "3.13"
[env]
_.python.venv = { path = ".venv", create = true }

Why: cd in and the venv is active; no python -m venv + source dance, and it works in CI and editors too. See Environments & Secrets.

Pin Node and get the right package-manager shims provisioned automatically via a per-tool postinstall.

mise.toml
[tools]
node = { version = "22", postinstall = "corepack enable" }

Why: mise install now leaves pnpm/yarn ready (driven by your packageManager field) — no global npm i -g pnpm. The postinstall hook gets MISE_TOOL_VERSION. See Watch, Hooks & Automation.

Make entering a project guarantee its tools are present, so teammates never hit “command not found”.

mise.toml
[hooks]
enter = "mise install"

Why: combined with a committed mise.lock, the first cd into a freshly cloned repo installs the exact pinned toolchain. Needs an active mise activate session. See Watch, Hooks & Automation.

Generate one mise.lock that resolves on every machine your team and CI use — Linux x64 and Apple Silicon, say.

Terminal window
mise lock --platform linux-x64,macos-arm64
mise.toml
[settings]
lockfile = true

Why: the lockfile records exact versions, checksums, and per-platform download URLs, so mise install --locked is reproducible everywhere. Commit mise.lock; there is no --frozen flag. See Tools & Backends.

End-to-end encrypted env that lives safely in the repo. The age private key stays on the machine, never committed.

Terminal window
mise use -g sops age
age-keygen -o ~/.config/mise/age.txt # note the public key it prints
sops encrypt -i --age <age-public-key> .env.json
mise.toml
[settings]
experimental = true # secrets are experimental
[env]
_.file = { path = ".env.json", redact = true } # auto-decrypts on load

Why: secrets are encrypted at rest and redacted in mise env output; mise finds the key via MISE_SOPS_AGE_KEY~/.config/mise/age.txt. For teams, look at jdx’s fnox. See Environments & Secrets.

Run one task across every project in the workspace with a single command.

mise.toml (repo root)
monorepo_root = true
[monorepo]
config_roots = ["packages/*", "services/*"]
Terminal window
mise run "//...:test" # run `test` in every config_root, at any depth
mise run "//services/api:deploy" # one specific project

Why: //...:task fans out across the monorepo; :task targets the current root. Declare config_roots — auto filesystem-walk discovery is deprecated. See Designing Your Workflow.

Layer environment-specific config on top of the base mise.toml.

mise.production.toml
[env]
LOG_LEVEL = "warn"
DATABASE_URL = { default = "postgres://prod-host/app" }
Terminal window
MISE_ENV=production mise run migrate

Why: MISE_ENV=production loads mise.production.toml over mise.toml (and mise.production.local.toml over that). Comma-list allowed, last wins. See Environments & Secrets.

Add a y/n gate before a task that drops data or deploys.

mise.toml
[tasks.db-reset]
run = "dropdb app_dev && createdb app_dev && mise run migrate"
confirm = "This wipes the dev database. Continue?"

Why: one key turns a footgun into a prompt; skip it in automation with MISE_YES=1 mise run db-reset. See The Task Runner.

Give a task real flags and arguments — typed, documented, and tab-completable.

mise.toml
[tasks.greet]
usage = '''
arg "<name>" help="Who to greet"
flag "-l --loud" help="Shout it"
'''
run = '''
msg="hello, $usage_name"
[ "$usage_loud" = "true" ] && msg=$(echo "$msg" | tr a-z A-Z)
echo "$msg"
'''
Terminal window
mise run greet world --loud # HELLO, WORLD

Why: parsed args surface as $usage_<name> env vars and feed shell completions. Don’t reach for the old Tera arg()/flag() functions — they’re removed in 2027.5.0. See The Task Runner.

Wire a mise task into git’s pre-commit hook in one command.

Terminal window
mise generate git-pre-commit --write --task pre-commit
mise.toml
[tasks.pre-commit]
run = "mise run lint ::: mise run test" # staged files available in $STAGED

Why: the generated hook just runs mise run pre-commit, so the logic lives in your committed config, not an unversioned .git/hooks script. For richer hooks see the sister tool hk. See Watch, Hooks & Automation.

Define shell aliases in mise.toml so they travel with the project (or your global config).

mise.toml
[shell_alias]
mr = "mise run"
mx = "mise exec --"

Why: project-scoped aliases that activate with the directory — no editing .zshrc for every repo. Needs an active mise activate session. See Install & Activate.

When a tool resolves to the wrong thing, these three answer “what does mise think is going on?”.

Terminal window
mise doctor # config, activation, untrusted paths, version warnings
mise which node # the real binary path mise resolves (not the shim)
mise where node@22 # the install directory for a specific version

Why: which node may show a shim; mise which node shows the actual resolved binary. mise doctor is the first stop for activation and trust problems — and confirms you’re on mise ≥ 2026.6.4. See Install & Activate.