jdx / mise
jdx / mise
mise-en-place Dev tools, env vars, and tasks in one CLI Getting Started • Documentation • Dev Tools • Environments • Tasks Sponsored by entire.io and 37signals. View all sponsors.
mise-en-place 在一个 CLI 中管理开发工具、环境变量和任务 入门指南 • 文档 • 开发工具 • 环境 • 任务 由 entire.io 和 37signals 赞助。查看所有赞助商。
Tip My latest project, aube just hit stable! It’s the fastest Node.js package manager with strong security defaults and is compatible with npm/pnpm/yarn lockfiles!
提示 我的最新项目 aube 刚刚发布了稳定版!它是目前最快的 Node.js 包管理器,具有强大的默认安全设置,并兼容 npm/pnpm/yarn 的锁文件!
What is it?
mise prepares your development environment before each command runs. It keeps project tools, environment variables, and tasks in one mise.toml file so new shells, checkouts, and CI jobs all start from the same setup.
它是什么?
mise 会在每条命令运行前准备好你的开发环境。它将项目工具、环境变量和任务统一保存在一个 mise.toml 文件中,确保新的 Shell、代码检出和 CI 任务都能从相同的配置启动。
Install and switch between dev tools like node, python, cmake, terraform, and hundreds more. Load environment variables per project directory, including values from .env files and other sources. Define and run tasks for building, testing, linting, and deploying projects.
安装并在 node、python、cmake、terraform 等数百种开发工具之间切换。按项目目录加载环境变量,包括来自 .env 文件和其他来源的值。定义并运行用于构建、测试、代码检查和部署项目的任务。
Demo
The following demo shows how to install and use mise to manage multiple versions of node on the same system. Note that calling which node gives us a real path to node, not a shim. It also shows that you can use mise to install and many other tools such as jq, terraform, or go. See demo transcript.
演示
以下演示展示了如何安装并使用 mise 在同一系统上管理多个 node 版本。请注意,调用 which node 会返回 node 的真实路径,而不是垫片(shim)。它还展示了你可以使用 mise 安装 jq、terraform 或 go 等许多其他工具。查看演示脚本。
Quickstart
Install mise
See Getting started for more options.
$ curl https://mise.run | sh
$ ~/.local/bin/mise --version
快速开始
安装 mise
查看“入门指南”获取更多选项。
$ curl https://mise.run | sh
$ ~/.local/bin/mise --version
Hook mise into your shell (pick the right one for your shell):
note this assumes mise is located at ~/.local/bin/mise
which is what https://mise.run does by default
echo 'eval "$(~/.local/bin/mise activate bash)"' >> ~/.bashrc
echo 'eval "$(~/.local/bin/mise activate zsh)"' >> ~/.zshrc
echo '~/.local/bin/mise activate fish | source' >> ~/.config/fish/config.fish
echo '~/.local/bin/mise activate pwsh | Out-String | Invoke-Expression' >> ~/.config/powershell/Microsoft.PowerShell_profile.ps1
将 mise 挂载到你的 Shell 中(选择适合你 Shell 的命令):
注意:这假设 mise 位于 ~/.local/bin/mise
这也是 https://mise.run 默认的操作
echo 'eval "$(~/.local/bin/mise activate bash)"' >> ~/.bashrc
echo 'eval "$(~/.local/bin/mise activate zsh)"' >> ~/.zshrc
echo '~/.local/bin/mise activate fish | source' >> ~/.config/fish/config.fish
echo '~/.local/bin/mise activate pwsh | Out-String | Invoke-Expression' >> ~/.config/powershell/Microsoft.PowerShell_profile.ps1
Execute commands with specific tools
$ mise exec node@26 -- node -v
mise node@26.x.x ✓ installed v26.x.x
使用特定工具执行命令
$ mise exec node@26 -- node -v
mise node@26.x.x ✓ 已安装 v26.x.x
Install tools
$ mise use --global node@26 go@1
$ node -v
v26.x.x
$ go version
go version go1.x.x macos/arm64
See dev tools for more examples.
安装工具
$ mise use --global node@26 go@1
$ node -v
v26.x.x
$ go version
go version go1.x.x macos/arm64
查看“开发工具”获取更多示例。
Manage environment variables
mise.toml
[env]
SOME_VAR = "foo"
$ mise set SOME_VAR=bar
$ echo $SOME_VAR
bar
Note that mise can also load .env files.
管理环境变量
mise.toml
[env]
SOME_VAR = "foo"
$ mise set SOME_VAR=bar
$ echo $SOME_VAR
bar
请注意,mise 也可以加载 .env 文件。
Run tasks
mise.toml
[tasks.build]
description = "build the project"
run = "echo building..."
$ mise run build
building...
See tasks for more information.
运行任务
mise.toml
[tasks.build]
description = "构建项目"
run = "echo building..."
$ mise run build
building...
查看“任务”获取更多信息。
Example mise project Here is a combined example to give you an idea of how you can use mise to manage your a project’s tools, environment, and tasks.
mise 项目示例 这是一个综合示例,让你了解如何使用 mise 来管理项目的工具、环境和任务。
Full Documentation See mise.jdx.dev
完整文档 请访问 mise.jdx.dev
GitHub Issues & Discussions Due to the volume of issue submissions mise received, using GitHub Issues became unsustainable for the project. Instead, mise uses GitHub Discussions which provide a more community-centric platform for communication and require less management on the part of the maintainers.
GitHub Issues 与 Discussions 由于 mise 收到的 Issue 数量巨大,继续使用 GitHub Issues 对该项目来说已不可持续。因此,mise 改用 GitHub Discussions,它提供了一个更以社区为中心的交流平台,且减少了维护者的管理负担。
Please note the following discussion categories, which match how issues are often used: Announcements Ideas: for feature requests, etc. Troubleshooting & Bug Reports
请注意以下讨论分类,它们对应了 Issue 的常见用途: 公告 (Announcements) 想法 (Ideas):用于功能请求等。 故障排除与 Bug 报告 (Troubleshooting & Bug Reports)
Special Thanks Thanks to Namespace for providing CI services for mise. Contributors
特别鸣谢 感谢 Namespace 为 mise 提供 CI 服务。 贡献者