mise, Alone
I previously wrote about using asdf and direnv together to manage my project dependencies and a per-project postgres version. I’ve now switched both to mise.
mise is a relative newcomer in the dev tooling space, and it aims to do much more than asdf and direnv did. I only use it where I need it, but so far I’ve found it delightful.
Tool Versions
My global mise configuration is small. I set ruby and node versions so a few global executables work, and enable idiomatic version files, which some of my projects still use (e.g. .ruby-version, .nvmrc):
# ~/.config/mise/config.toml
[tools]
ruby = "3.4.1"
node = "25.4.0"
[settings]
idiomatic_version_file_enable_tools = ["ruby", "node", "python"]
Then, per project, I typically define more specific versions:
# .tool-versions
ruby 3.4.1
postgres 16.4
nodejs 24.15.0
mise reads .tool-versions files exactly as asdf did, and I prefer them to idiomatic version files.
Environment Loading
Most of my projects also load a .env file, sometimes add a directory to the PATH, and watch for changes. To do that without checking in a file my teammates don’t need, I use a globally gitignored mise.local.toml. It applies to me alone. If a project ever adds a mise.toml, I’ll check which parts of mise.local.toml I still need.
# mise.local.toml
[env]
_.file = ".env" # Loads .env file
_.path = ["bin"] # Adds bin to path
[[watch_files]]
patterns = [".env"]
run = "true"
On its own, the [env] section doesn’t reload .env when it changes. I want it to, and the [[watch_files]] section takes care of that. The run = "true" is there because mise expects a command or a task to run when a watched file changes. Reloading the environment doesn’t need one, so true serves as a no-op.
Per-project Postgres
On some projects, I need a specific version of postgres. I ported my direnv version of that setup:
~/.config/mise/layout_postgres.sh:
#!/usr/bin/env bash
# NOTE: The .direnv directory name is still here to avoid switching the postgres directory
# in all my projects. I'll get to that eventually.
PGDATA="${MISE_LAYOUT_DIR:-$PWD/.direnv}/postgres_$(postgres --version | awk '{ print $3 }')"
PGHOST="$PGDATA"
export PGDATA PGHOST
if [[ ! -d "$PGDATA" ]]; then
echo "mise: initializing postgres for this project..." >&2
initdb >&2
cat >> "$PGDATA/postgresql.conf" <<-EOF
listen_addresses = ''
unix_socket_directories = '$PGHOST'
EOF
echo "CREATE DATABASE $USER;" | postgres --single -E postgres >&2
fi
And I enable it in mise.local.toml:
# mise.local.toml
[env]
_.source = { path = "~/.config/mise/layout_postgres.sh", tools = true }
_.file = { path = ".env", tools = true }
The tools = true on _.source puts the mise-managed tools on the PATH while the script runs. Without it, the script might pick up the wrong version of postgres and initdb, or not find them at all. On _.file, it’s about ordering: mise applies tools = true directives after all others, so marking both keeps them in the order I wrote them. For one of my projects, I want to lay out postgres, which sets PGDATA and PGHOST, and then override them in .env (for reasons that don’t matter for this post). Without tools = true on _.file, mise would load .env first, and the script would then overwrite those values.
Conclusion
Moving my configuration from asdf and direnv to mise has been relatively easy. mise has many more features I haven’t explored, and some that delighted me right away, like pre-built ruby binaries that make installation much faster.
Find me on:
- Bluesky at @ylan.segal.family.com
- Mastodon at @ylansegal@mastodon.sdf.org
- By email at
ylan@{this top domain}