跳转到内容
mise run,主题曲 与音乐视频

mise-en-place

CLI 中的开发工具、环境变量和任务

mise 的发音是 “meez”

mise 从一个能在 shell、编辑器和 CI 中通用的 mise.toml 安装项目工具、设置环境变量并运行任务。借助 mise bootstrap,它还可以配置整台机器,包括软件包、点文件和服务。

curl -fsSL https://mise.run | sh

macOS & Linux 正在 Windows 上安装?

mise.toml示例配置

# 此项目的工具版本

[tools]
node = "24"
python = "3.14"

输出示例 ~/my-project

$ mise install
✓ 在 6.2 秒内安装了 2 个工具:[email protected]、[email protected]
探索 工具
开源,采用 MIT 许可证
  • macOS、Linux 和 Windows
  • 使用 Rust 编写
  • 每周发布数次

02 日常使用

切换目录。一切随之而变。

只需在 shell 中激活一次 mise。之后,进入项目时,其已安装的工具版本会加入你的 PATH,并加载项目的环境变量。离开项目后,mise 会为新目录恢复环境。

  • Shell activation for bash, zsh, fish, Nushell, PowerShell, and more
  • Shims for editors and scripts that never read your shell startup file
  • mise exec for scripts and containers, and a GitHub Action for CI
当前 shell~/work/api
Node
22
APP_ENV
api
选择一个项目以查看其环境。需要启用 shell,并安装对应的工具版本。

03 新机器

声明你的设置mise.toml[bootstrap.packages]
[bootstrap.repos]
[dotfiles]
[bootstrap.services]
mise bootstrap
Packagesbrew · apt · scoop · winget
RepositoriesProject checkouts
DotfilesTrack · link · template
ServicesBackground processes
mise bootstrap --dry-run shows what will change before you apply it.

为整台机器使用一个配置。

Declare the packages, repositories, dotfiles, and services a machine needs, then apply them with mise bootstrap. Run mise bootstrap --dry-run first to see what will change. This setup belongs to the machine, not to a project, so it usually lives in your global config or in a repository of your own.

  • Packages from apt, dnf, pacman, AUR, zypper, apk, nix, flatpak, snap, Homebrew formulae and casks, direct macOS app downloads, mas, scoop, winget, and package manager plugins
  • Dotfiles tracked in place with history you can roll back and sync between machines, or applied as symlinks, copies, templates, and line or block edits
  • Remote hosts over SSH with mise bootstrap remote

Set up a new machine from a repository that holds your mise.toml:

mise bootstrap --from [email protected]:you/dotfiles.git

Read the bootstrap guide or the dotfiles guide.

04 快速开始

运行你的第一个项目任务。

  1. Step 1

    Install mise

    On macOS or Linux, run the installer. It puts mise in ~/.local/bin; if that is not on your PATH, type ~/.local/bin/mise in the next two steps. On Windows, run winget install jdx.mise. See Installing mise for other methods.

    $ curl -fsSL https://mise.run | sh
    $ ~/.local/bin/mise --version
  2. Step 2

    Try a tool

    mise exec installs Node.js 24 if needed and runs one command with it. Your shell and config files stay as they were.

    $ mise exec node@24 -- node --version
    v24.x.x
  3. Step 3

    Set up a project

    These commands write [tools], [env], and [tasks.hello] to the project's mise.toml. The task runs with the project's Node.js and NODE_ENV. Commit mise.toml so teammates and CI get the same setup.

    $ mkdir my-project && cd my-project
    $ mise use node@24
    mise ~/my-project/mise.toml tools: [email protected]
    $ mise set NODE_ENV=development
    $ mise tasks add hello -- node -p process.env.NODE_ENV
    $ mise run hello
    [hello] $ node -p process.env.NODE_ENV
    development
  4. Step 4 (optional)

    Activate mise in your shell

    Activation puts the project's tools and environment variables in your shell when you enter the project, so node works without mise exec. Run the commands for your shell once, then open a new shell. For PowerShell, Nushell, and others, see Shell setup.

    # bash
    $ echo 'eval "$(~/.local/bin/mise activate bash)"' >> ~/.bashrc
    # zsh
    $ echo 'eval "$(~/.local/bin/mise activate zsh)"' >> "${ZDOTDIR:-$HOME}/.zshrc"
    # fish
    $ mkdir -p ~/.config/fish
    $ echo '~/.local/bin/mise activate fish | source' >> ~/.config/fish/config.fish

— Install mise

Allez. Prep your station.

curl -fsSL https://mise.run | sh

— Related project

Share Cargo builds with Mr Boxington

Give every Cargo checkout one shared, self-pruning compilation cache, locally and in CI.

mr-boxington.jdx.dev