miseによる開発ツールバージョン管理
miseは、Node.js、Python、Ruby、Flutter、.NETなど複数の開発ツールのバージョンを統一的に管理できるツールです。asdfの後継として開発されており、より高速で使いやすくなっています。
インストール
Section titled “インストール”brew install miseシェルの設定
Section titled “シェルの設定”.zshrcに追加:
eval "$(mise activate zsh)".bashrcに追加(bashユーザー):
eval "$(mise activate bash)".bash_profileに追加(必要に応じて):
export PATH="$HOME/.local/share/mise/shims:$PATH"設定を反映:
source ~/.zshrc基本的な使い方
Section titled “基本的な使い方”ツールのインストール
Section titled “ツールのインストール”# 最新の安定版をインストールmise install node@latestmise install python@latest
# 特定バージョンをインストールmise install node@18.17.0mise install flutter@3.16.7バージョンの設定
Section titled “バージョンの設定”# プロジェクトでの使用(.mise.tomlが作成される)mise use node@18.17.0mise use python@3.11.3
# グローバル設定mise use -g node@18.17.0mise use -g flutter@3.19.3-stableインストール済みツールの確認
Section titled “インストール済みツールの確認”# すべてのツールとバージョンを表示mise list
# 特定のツールのバージョンを表示mise list node各言語・ツールの設定
Section titled “各言語・ツールの設定”Flutter
Section titled “Flutter”# Flutter(Dartも同時にインストールされる)mise use flutter@3.16.7
# グローバルに設定mise use -g flutter@3.19.3-stableNode.js
Section titled “Node.js”# LTS版をインストールmise install node@ltsmise use node@lts
# 特定バージョンmise use node@20.11.0Python
Section titled “Python”# 最新の3.11系をインストールmise install python@3.11mise use python@3.11# .NET 8をインストールmise use dotnet@8
# .NET 6をプロジェクトで使用mise use dotnet@6# Ruby 3.2をインストールmise use ruby@3.2プロジェクト設定
Section titled “プロジェクト設定”.mise.tomlファイル
Section titled “.mise.tomlファイル”プロジェクトルートに.mise.tomlを作成:
[tools]node = "18.17.0"python = "3.11.3"flutter = "3.16.7"レガシーバージョンファイルのサポート
Section titled “レガシーバージョンファイルのサポート”miseは以下のファイルも自動で読み込みます:
.nvmrc(Node.js).ruby-version(Ruby).python-version(Python)
有効化するには:
mise settings set legacy_version_file trueプラグイン管理
Section titled “プラグイン管理”利用可能なプラグイン一覧
Section titled “利用可能なプラグイン一覧”mise plugins list-allプラグインの追加
Section titled “プラグインの追加”# 公式プラグインの追加(自動)mise install terraform
# カスタムプラグインの追加mise plugins add custom-tool https://github.com/user/mise-custom-tool.gitアンインストール
Section titled “アンインストール”特定バージョンの削除
Section titled “特定バージョンの削除”mise uninstall flutter@3.19.3mise uninstall dart@3.3.1ツールの完全削除
Section titled “ツールの完全削除”mise uninstall nodeトラブルシューティング
Section titled “トラブルシューティング”Flutterでエラーが発生する場合
Section titled “Flutterでエラーが発生する場合”# Dartパッケージキャッシュの修復dart pub cache repair
# または依存関係の更新dart pub update# miseの環境を確認mise doctor
# シムのパスを確認which nodewhich flutterキャッシュのクリア
Section titled “キャッシュのクリア”# miseのキャッシュをクリアmise cache clear環境変数の管理
Section titled “環境変数の管理”.mise.tomlで環境変数も管理できます:
[env]NODE_ENV = "development"DATABASE_URL = "postgresql://localhost/myapp"
[tools]node = "18.17.0"asdfからの移行
Section titled “asdfからの移行”既存の.tool-versionsファイルがある場合:
# .tool-versionsから.mise.tomlへ変換mise install # .tool-versionsを自動で読み込みmise use # .mise.tomlを生成よく使うコマンド
Section titled “よく使うコマンド”# 現在の設定を表示mise current
# 利用可能なバージョンを表示mise list-remote node
# 設定ファイルの編集mise edit
# 環境情報の表示mise envベストプラクティス
Section titled “ベストプラクティス”-
プロジェクトごとに.mise.tomlを作成
- バージョンを明確に固定
- チーム間で環境を統一
-
グローバル設定は最小限に
- 開発ツールの基本的なものだけ
- プロジェクト固有の設定を優先
-
定期的なアップデート
Terminal window # mise自体のアップデートbrew upgrade mise# プラグインのアップデートmise plugins update