Go、
このmise.toml 一ファイルで
mise の
- 第 1 弾:複数言語の
バージョン管理 (本記事) - 第 2 弾:実行系
(backends、 mise.lock、 mise exec) - 第 3 弾:タスクランナー
(tasks、 mise generate) - 第 4 弾:環境変数管理
(env、 hooks、 secrets)
mise とは
mise は
はじめはrtx とmise へと
インストール
macOS では
brew install mise
Linux でも
curl https://mise.run | sh
インストール後、
# fish
mise activate fish | source
# zsh
eval "$(mise activate zsh)"
# bash
eval "$(mise activate bash)"
fish での
# ~/.config/fish/config.fish
if type -q mise
mise activate fish | source
end
基本的な使い方
グローバルにツールをインストールする
# ツールをインストールして、グローバルに有効化
mise use -g node@22
mise use -g python@3.13
mise use -g go@latest
-g(--global)~/.config/mise/config.toml に
# ~/.config/mise/config.toml
[tools]
node = "22"
python = "3.13"
go = "latest"
latest とmise upgrade でmise ls で
プロジェクトごとにバージョンを指定する
プロジェクトルートにmise.toml を.mise.toml もmise.toml で
# プロジェクトルートの mise.toml
[tools]
node = "20"
python = "3.11"
cd で
cd ~/project-a # node 20, python 3.11 が有効になる
cd ~/project-b # mise.toml がなければグローバル設定が適用される
ただし、mise.toml はmise trust で
# プロジェクトの設定を信頼する
mise trust
# CI 環境などで対話なしに信頼させる場合
mise trust --all
asdf 形式の .tool-versions も読める
.tool-versions もmise は.tool-versions を
# .tool-versions(asdf 形式)
nodejs 20.11.0
python 3.11.8
asdf との比較
mise は
shim と PATH の違い
最も
asdf はPATH を
ただし、
asdf の Go 書き換え(0.16 以降)
2025 年前半に
書き換えのasdf global / asdf local がasdf set とmise set(環境変数を
mise が追加で持つ機能
asdf との
環境変数のmise.toml 一ファイルに
また、mise use node@22 の
asdf の方が有利なケースは?
チームに.tool-versions で
また、
言語専用ツール(nvm / pyenv / rbenv)との比較
「Node.js しか
ただ、
- nvm は
遅延ロードを 工夫しないと シェル 起動が 重くなる - pyenv は
pyenv initをシェルに 仕込む 必要が あり、 設定が 散らばる - ツールごとに
コマンド体系が 違う ため、 「バージョン一覧を 出すコマンド」を 毎回 調べるはめに なる
mise ならmise use -g go@latest ruby@latest node@22 で
uv との関係と使い分け
Python をuv python install 3.13)も
「mise の
| mise | uv | |
|---|---|---|
| 対応言語 | Go、Node、Python、Ruby など多言語 | Python のみ |
| パッケージ管理 | なし | あり(pip 相当) |
| 仮想環境管理 | なし(uv や venv に委譲) | あり(venv 相当) |
uv は
Python バージョン管理のダブル管理問題
もっとも、uv python install 3.13 と
実際、
- mise:
~/.local/share/mise/installs/python/3.13.x/ - uv:
~/.local/share/uv/python/cpython-3.13.x-*/
両方で
推奨するuv python install は
mise がuv python install を
# Python バージョンは mise だけで管理
mise use -g python@3.13
# uv はパッケージ管理・仮想環境のみ担当(python install はしない)
cd my-project
uv venv # mise が提供する python で仮想環境を作成
uv pip install fastapi
uv がuv python find で
プロジェクトのpyproject.toml のrequires-python に
# pyproject.toml
[project]
requires-python = ">=3.13"
実際の組み合わせ方
自分の
- mise: Python を
含む すべての ランタイムの バージョン管理 - uv: Python の
パッケージ管理と 仮想環境管理 ( uv python installは使わない)
uv 自体も
# ~/.config/mise/config.toml
[tools]
python = "3.13"
uv = "latest"
uv プロジェクトuv.lock がpython.uv_venv_auto 設定を.venv だけを"source" と、"create|source" のuv.lock がtrue と
# mise.toml
[settings]
python.uv_venv_auto = "source" # 既存の .venv を自動で有効化
# または
python.uv_venv_auto = "create|source" # なければ作成してから有効化
「Python バージョン管理も
OS サポートと注意点
mise は
Windows
Windows でもmise activate pwsh もmise exec やmise run に
一方で、
CI 環境
GitHub Actions では
# .github/workflows/ci.yml
- uses: jdx/mise-action@v4
これでmise.toml の
チームでの運用:全員インストールを強制する必要があるか
実務では
正直なmise.toml にmise.toml は
現実的な
mise.toml と .tool-versions を共存させる
.tool-versions をmise ユーザーはmise.toml、.tool-versions を
# mise.toml
[tools]
node = "20.11.0"
python = "3.11.8"
# .tool-versions(asdf ユーザー向けに併置)
nodejs 20.11.0
python 3.11.8
Dockerfile でバージョンを固定する
コンテナを
各言語の設定ファイルにバージョン制約を書く
mise を
// package.json
{
"engines": { "node": ">=20.0.0" }
}
# pyproject.toml
[project]
requires-python = ">=3.11"
これらの
mise を入れない開発者との環境差異
mise をnode -v が
環境変数の管理
mise は[env] セクションに
# mise.toml
[tools]
node = "20"
[env]
NODE_ENV = "development"
DATABASE_URL = "postgres://localhost:5432/mydb_dev"
ここでmise activate を.env の
実際の設定例
自分の
# ~/.config/mise/config.toml(macOS の場合)
[plugins]
flutter = "https://github.com/mise-plugins/mise-flutter.git"
[tools]
awscli = "latest"
direnv = "latest"
flutter = "latest"
fzf = "latest"
gcloud = "latest"
ghq = "latest"
go = "latest"
java = "temurin"
kubectl = "latest"
node = "latest"
peco = "latest"
ruby = "latest"
starship = "latest"
stern = "latest"
terraform = "latest"
uv = "latest"
flutter のように[plugins] セクションでmise.toml を
新しいmise install 一コマンドで
まとめ
言語ごとのmise.toml が
asdf からの.tool-versions 互換の
続きは第 2 弾で、