跳转到内容

mise activate ​

打印用于在交互式 Shell 中激活 mise 的脚本

使用 Shell 的语法执行此命令的输出;单独运行它只会打印脚本。激活功能会随着此 Shell 切换目录而更新工具和环境变量。

Add the matching example below once to your interactive startup file: ~/.bashrc for Bash, ~/.zshrc for Zsh, ~/.config/fish/config.fish for Fish, or $PROFILE for PowerShell. For Nushell, Elvish and other shells, see https://mise.jdx.dev/shell-setup.html.

执行该行之前,mise 可执行文件必须位于 PATH 中。否则请使用其绝对路径,例如 eval "$(~/.local/bin/mise activate zsh)"。

Use mise exec -- command for scripts and CI that do not need interactive hooks. The status.* settings control the messages mise prints when you change directories.

参数 ​

  • [SHELL_TYPE] — 要为其生成脚本的 Shell 类型

    Defaults to the shell named by MISE_SHELL or SHELL. mise reports an error when neither names a supported shell, as in PowerShell and cmd on Windows.

    Choices: bash, elvish, fish, nu, xonsh, zsh, pwsh, powershell

Flags ​

  • -q --quiet — Suppress non-error messages from the hook that runs at each prompt

  • --no-hook-env — Do not run hook-env automatically

    Use it for debugging: after eval "$(mise activate zsh --no-hook-env)", run mise hook-env yourself to print the shell code it would evaluate, or mise hook-env --trace for more detail.

  • --shims — Put the shims directory on PATH instead of updating PATH at each prompt

    Roughly equivalent to:

    PATH="$HOME/.local/share/mise/shims:$PATH"

    Shims do not support every feature of mise activate; see https://mise.jdx.dev/dev-tools/shims.html#shims-vs-path.

  • -h --help — Print help

示例 ​

Activate mise in Bash

eval "$(mise activate bash)"

Activate mise in Zsh

eval "$(mise activate zsh)"

Activate mise in Fish

mise activate fish | source

Activate mise in Xonsh

execx($(mise activate xonsh))

Activate mise in PowerShell

(&mise activate pwsh) | Out-String | Invoke-Expression

相关文档 ​