ถ้าคุณเป็นนักพัฒนาที่ต้องใช้ nvm จัดการ Node.js, pyenv จัดการ Python, rbenv จัดการ Ruby, jenv จัดการ Java... คุณรู้ดีว่ามันวุ่นวายแค่ไหน ต้องติดตั้งทุกตัว ตั้งค่าแยกกัน Config ชนกัน Shell เปิดช้าเพราะ Init Script เยอะ
mise (อ่านว่า "มีซ" — มาจากภาษาฝรั่งเศสแปลว่า "วาง/ตั้ง") คือเครื่องมือตัวเดียวที่ทดแทนทั้งหมด จัดการ Runtime Versions, Environment Variables, Task Runner ในที่เดียว
mise vs เครื่องมือเดิม
| ฟีเจอร์ | nvm/pyenv/rbenv | asdf | mise |
|---|---|---|---|
| จัดการ Runtime | ได้ (แยกตัวละภาษา) | ได้ (รวมทุกภาษา) | ได้ (รวมทุกภาษา) |
| ความเร็ว | ปานกลาง | ช้า (Shell Script) | เร็วมาก (Rust) |
| Task Runner | ไม่มี | ไม่มี | มี (แทน Makefile) |
| Environment Variables | ไม่มี | ไม่มี | มี (แทน direnv) |
| Config File | .nvmrc, .python-version | .tool-versions | .mise.toml (+ compatible กับทั้งหมด) |
| Compatible กับ Plugin เดิม | - | ใช้ Plugin ของตัวเอง | ใช้ asdf Plugin ได้ + มี Core Plugin |
| ภาษาที่เขียน | Shell/C | Shell | Rust (เร็วมาก) |
ติดตั้ง mise
# macOS / Linux
curl https://mise.run | sh
# หรือ Homebrew (macOS/Linux)
brew install mise
# Windows (ผ่าน Scoop)
scoop install mise
# Windows (ผ่าน Chocolatey)
choco install mise
# ตรวจสอบ
mise --version
เพิ่ม mise เข้า Shell
# Bash (~/.bashrc)
echo 'eval "$(mise activate bash)"' >> ~/.bashrc
# Zsh (~/.zshrc)
echo 'eval "$(mise activate zsh)"' >> ~/.zshrc
# Fish (~/.config/fish/config.fish)
echo 'mise activate fish | source' >> ~/.config/fish/config.fish
# PowerShell ($PROFILE)
echo 'mise activate pwsh | Invoke-Expression' >> $PROFILE
# Restart shell
source ~/.bashrc # or ~/.zshrc
จัดการ Runtime Versions ด้วย .mise.toml
ติดตั้ง Runtime
# ติดตั้ง Node.js
mise use node@20 # ติดตั้ง + ตั้งเป็น Default ใน Directory นี้
mise use node@20.12.0 # ระบุ Version เฉพาะ
mise use -g node@20 # ตั้งเป็น Global Default
# ติดตั้ง Python
mise use python@3.12
mise use python@3.11.8
# ติดตั้ง Ruby
mise use ruby@3.3
# ติดตั้ง Go
mise use go@1.22
# ดู Runtime ที่ติดตั้งแล้ว
mise list
mise list node
# ดู Version ที่มีให้ติดตั้ง
mise ls-remote node
mise ls-remote python
.mise.toml — Config File หลัก
# .mise.toml (ใส่ใน Root ของโปรเจกต์)
[tools]
node = "20"
python = "3.12"
ruby = "3.3"
# ระบุ Version เฉพาะ
# node = "20.12.0"
# python = "3.11.8"
# ติดตั้งหลาย Version
# python = ["3.12", "3.11"]
[env]
DATABASE_URL = "postgresql://localhost/myapp"
REDIS_URL = "redis://localhost:6379"
NODE_ENV = "development"
[tasks.dev]
run = "npm run dev"
description = "Start development server"
[tasks.test]
run = "npm test"
description = "Run tests"
[tasks.lint]
run = "npm run lint"
description = "Run linter"
.nvmrc, .python-version, .ruby-version, .tool-versions (asdf) ได้ทั้งหมด! ไม่ต้องเปลี่ยน Config ของโปรเจกต์เดิม
mise Plugins
mise รองรับ asdf Plugin ทั้งหมด + มี Core Plugin สำหรับ Runtime ยอดนิยมที่เร็วกว่า:
| Core Plugin (Built-in) | asdf Plugin (Community) |
|---|---|
| node, python, ruby, go, java, rust, bun, deno | terraform, kubectl, helm, erlang, elixir, php, perl, lua, zig + อีกหลายร้อยตัว |
# ดู Plugin ที่มี
mise plugins list-all
# ติดตั้ง Plugin (ถ้าไม่ใช่ Core)
mise plugins install terraform
mise plugins install kubectl
# ใช้งาน
mise use terraform@1.7
mise use kubectl@1.29
mise Tasks — Task Runner ในตัว
mise มี Task Runner ในตัว ทดแทน Makefile, npm scripts, หรือ just:
# .mise.toml
[tasks.dev]
run = "npm run dev"
description = "Start development server"
[tasks.build]
run = "npm run build"
description = "Build for production"
[tasks.test]
run = "pytest tests/"
description = "Run Python tests"
depends = ["lint"] # รัน lint ก่อน test
[tasks.lint]
run = "ruff check ."
description = "Lint Python code"
[tasks.db-migrate]
run = "python manage.py migrate"
description = "Run database migrations"
[tasks.deploy]
run = """
npm run build
rsync -avz dist/ server:/var/www/
"""
description = "Build and deploy"
depends = ["test"] # รัน test ก่อน deploy
# รัน Tasks
mise run dev
mise run test
mise run deploy
# หรือใช้ shortcut
mise r dev
mise r test
# ดู Tasks ทั้งหมด
mise tasks
mise env — Environment Variables
mise จัดการ Environment Variables ได้ในตัว ทดแทน direnv:
# .mise.toml
[env]
DATABASE_URL = "postgresql://localhost/myapp_dev"
REDIS_URL = "redis://localhost:6379"
SECRET_KEY = "dev-secret-key-change-in-production"
NODE_ENV = "development"
LOG_LEVEL = "debug"
# ใช้ค่าจากไฟล์ .env
_.file = ".env"
# ใช้ค่าจาก Path
_.path = ["./bin", "./node_modules/.bin"]
# ดู Environment Variables ที่ mise ตั้ง
mise env
# ดู env เฉพาะตัว
mise env | grep DATABASE
mise ใน CI/CD
# GitHub Actions
name: CI
on: [push, pull_request]
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: jdx/mise-action@v2
- run: mise run test
# GitLab CI
test:
image: ubuntu:latest
before_script:
- curl https://mise.run | sh
- eval "$(mise activate bash)"
- mise install
script:
- mise run test
mise + direnv
ถ้าใช้ direnv อยู่แล้ว mise สามารถทำงานร่วมกันได้:
# .envrc (direnv)
use mise
# direnv จะโหลด mise tools + env ให้อัตโนมัติ
Migrate จาก nvm/pyenv
จาก nvm
# nvm เดิม: .nvmrc
# 20.12.0
# mise: ไม่ต้องเปลี่ยน! mise อ่าน .nvmrc ได้
# หรือสร้าง .mise.toml
mise use node@20
# ลบ nvm (Optional)
# ลบ nvm init จาก ~/.bashrc
# rm -rf ~/.nvm
จาก pyenv
# pyenv เดิม: .python-version
# 3.12.0
# mise: ไม่ต้องเปลี่ยน! mise อ่าน .python-version ได้
# หรือสร้าง .mise.toml
mise use python@3.12
# ลบ pyenv (Optional)
# ลบ pyenv init จาก ~/.bashrc
# rm -rf ~/.pyenv
จาก asdf
# asdf เดิม: .tool-versions
# nodejs 20.12.0
# python 3.12.0
# mise: ไม่ต้องเปลี่ยน! mise อ่าน .tool-versions ได้
# หรือ convert เป็น .mise.toml
mise settings set experimental true
mise config
mise สำหรับทีม
ทำไม mise ดีสำหรับทีม?
- ทุกคนใช้ Runtime Version เดียวกัน: Commit
.mise.tomlเข้า Git ทุกคนmise installได้ Version เดียวกัน - ไม่ต้องเขียน README ยาว: แค่บอกว่า "ติดตั้ง mise แล้วรัน
mise install" - Environment Variables ตรงกัน:
.mise.tomlกำหนด env ให้เหมือนกัน - Tasks ตรงกัน:
mise run testทำเหมือนกันทุกเครื่อง
Setup สำหรับทีม
# 1. ทุกคนติดตั้ง mise
curl https://mise.run | sh
# 2. Clone โปรเจกต์
git clone https://github.com/team/project.git
cd project
# 3. ติดตั้ง Tools ทั้งหมด
mise install
# 4. พร้อมทำงาน!
mise run dev
IDE Integration
| IDE | วิธีใช้กับ mise |
|---|---|
| VS Code | ติดตั้ง mise Extension หรือ ตั้ง python.defaultInterpreterPath เป็น ~/.local/share/mise/installs/python/3.12/bin/python |
| JetBrains (IntelliJ, PyCharm, WebStorm) | ตั้ง SDK Path ไปที่ mise install path |
| Neovim | mise activate ใน Shell แล้ว Neovim จะใช้ Runtime ที่ mise ตั้งอัตโนมัติ |
# ดู Path ของ Runtime ที่ mise ติดตั้ง
mise where node
# ~/.local/share/mise/installs/node/20.12.0
mise where python
# ~/.local/share/mise/installs/python/3.12.0
# ใช้ Path นี้ตั้ง SDK ใน IDE
สรุป: mise = อนาคตของ Dev Environment Management
| ต้องการ | เดิม | ใช้ mise |
|---|---|---|
| จัดการ Node.js | nvm | mise use node@20 |
| จัดการ Python | pyenv | mise use python@3.12 |
| จัดการ Ruby | rbenv | mise use ruby@3.3 |
| จัดการหลายภาษา | asdf | mise (เร็วกว่า) |
| Environment Variables | direnv | mise env (built-in) |
| Task Runner | Makefile/just | mise tasks (built-in) |
mise เป็นเครื่องมือที่รวมทุกอย่างไว้ในตัวเดียว เร็ว ใช้ง่าย Compatible กับ Config เดิม ถ้าคุณยังใช้ nvm + pyenv + direnv + Makefile แยกกัน ลองเปลี่ยนมาใช้ mise ดู ชีวิต Developer จะง่ายขึ้นมาก
