Skip to content

Instantly share code, notes, and snippets.

@yano3nora
Last active June 29, 2026 08:49
Show Gist options
  • Select an option

  • Save yano3nora/ecf8f96c4863242308a8a82b4f83b627 to your computer and use it in GitHub Desktop.

Select an option

Save yano3nora/ecf8f96c4863242308a8a82b4f83b627 to your computer and use it in GitHub Desktop.
mise - mise-en-place

mise

https://mise.jdx.dev/

  • linux, mac 向けの alternative asdf
  • windows support は限定的なので注意

Installation

$ curl https://mise.run | sh
$ echo 'eval "$(~/.local/bin/mise activate zsh)"' >> ~/.zshrc

Getting Started

プロジェクト立ち上げ時、以下のような構成を行う。

# プロジェクトで利用するツールとして node, jq, rg を指定しつつ install
$ mise use node@24.14.1 jq ripgrep

# direnv (.envrc) みたいな設定を作成 (要 ignore) して読ませることも
$ touch .local.env
$ echo "API_KEY=XXXX" >> .local.env
[tools]
jq = "latest"
node = "24.14.1"
ripgrep = "latest"

[env]
HOGE_ENV = 1 # 環境変数の自動適用
_.file = ".env.local" # ファイル読み込みで適用するなら

[tasks.pre-commit] # husky みたいな git-hooks
description = "commit 時に lint + format + test を実行"
run = "npm test"

追従するメンバーは clone したら以下を一度だけやる感じ。

# git clone したメンバーは trust & install で tools を setup
$ mise trust && mise install

# pre-commit など git-hooks の有効化
$ mise generate git-pre-commit --task pre-commit --write

Show env keys by hook

direnv みたいにディレクトリ入ったとき有効化された環境変数を一覧するやつ。

[settings]
experimental = true

[hooks]
enter = "mise env --json | jq -r 'keys | join(\" \")'" # show env list on enter directory

Shell alias

[shell_alias]
d = "docker compose" # d build / d up / d down
"d:run" = "docker compose run --rm" # d:run app npm test
"d:app" = "docker compose run --rm app" # d:app npm test

Multiple Tasks

tasks の run を配列にすればい複数コマンド登録できるので provisioning などを構成可能。

[tasks.provision]
description = "初期セットアップ"
run = [
  "docker compose build",
  "docker compose run --rm app npm ci",
  "docker compose run --rm app npm run db:migrate",
  "docker compose run --rm app npm run db:seed",
]
$ mise run provision

[tools]

python, node など言語の他に ripgrep や jq などツール類まで、依存バイナリをまとめられる。

idiomatic version file

jdx/mise#4345

  • .node-version みたいなやつのことを idiomatic version file と言ってる
  • mise は 2025.10 以降これらのファイルを無視する決定を行った
  • 2025.10 以降も .node-version などを尊重したいなら以下の設定が必要
# ~/.config/mise/config.toml
[settings]
idiomatic_version_file_enable_tools = ['node']

Node.js

  • node@24.14.1 を global install するケース
  • use で「インストール&利用設定」を一発でできる
  • version の細部を記憶したいなら --pin するみたい
$ mise use -g --pin node@24.14.1
$ node -v # v24.14.1
$ cat ~/.config/mise/config.toml
# [tools]
# node = "24.14.1"
  • 特定 project 向けの node version をいれるなら install で「用意するだけ」になる
  • mise.toml や .node-version など存在する directory で ↓ ふるまいに
    • 指定 version がある => 勝手に切り替え
    • 指定 version がない => warning 出力
$ mise install node@18.19.1

use を -g (global) なしで叩くと mise.toml 作成して利用設定しながら install するよう。

$ mise use node@18.19.1
$ cat mise.toml
# [tools]
# node = "22.19.0"

Python

# check latest version
$ mise latest python # 3.13.7

# install & use as global
$ mise use -g --pin python@3.13.7

# check
$ python --version # 3.13.7
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment