Cargo Backend
You may install packages directly from Cargo Crates even if there isn't an asdf plugin for it.
The code for this is inside the mise repository at ./src/backend/cargo.rs.
Dependencies
This relies on having cargo installed. You can either install it on your system via rustup:
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | shOr you can install it via mise:
mise use -g rustUsage
The following installs the latest version of eza and sets it as the active version on PATH:
$ mise use -g cargo:eza
$ eza --version
eza - A modern, maintained replacement for ls
v0.17.1 [+git]
https://github.com/eza-community/ezaThe version will be set in ~/.config/mise/config.toml with the following format:
[tools]
"cargo:eza" = "latest"Using Git
You can install any package from a Git repository using the mise command. This allows you to install a particular tag, branch, or commit revision:
# Install a specific tag
mise use cargo:https://github.com/username/demo@tag:<release_tag>
# Install the latest from a branch
mise use cargo:https://github.com/username/demo@branch:<branch_name>
# Install a specific commit revision
mise use cargo:https://github.com/username/demo@rev:<commit_hash>This will execute a cargo install command with the corresponding Git options.
Settings
Set these with mise settings set [VARIABLE] [VALUE] or by setting the environment variable listed.
Some Cargo settings are only meaningful when mise runs cargo install. If cargo-binstall installs a prebuilt binary, Cargo build settings and cargo install behavior do not affect that artifact. Set cargo.binstall = false when you need Cargo settings to control the install.
When mise uses cargo-binstall, mise runs cargo-binstall once and lets cargo-binstall handle its own fallback order, including its final fallback to compiling with cargo install. mise does not retry with a separate cargo install command if cargo-binstall exits with an error.
cargo.binstall
- Type:
boolean - Env:
MISE_CARGO_BINSTALL - Default:
true
If true, mise will use cargo binstall instead of cargo install if
cargo-binstall is installed and on PATH.
This makes installing CLIs with cargo much faster by downloading precompiled binaries.
When cargo-binstall installs a prebuilt binary, Cargo build settings and cargo install
behavior do not affect the downloaded artifact. Set cargo.binstall = false to force
cargo install when you need Cargo settings to control the install.
When mise invokes cargo-binstall, cargo-binstall handles its own fallback order, including
its final fallback to compiling with cargo install. mise does not retry with a separate
cargo install command if cargo-binstall exits with an error.
You can install it with mise:
mise use -g cargo-binstall
cargo.binstall_only
- Type:
boolean - Env:
MISE_CARGO_BINSTALL_ONLY - Default:
false
Only use cargo-binstall for installation, fail if not available.
cargo.registry_name
- Type:
string(optional) - Env:
MISE_CARGO_REGISTRY_NAME - Default:
None
Packages are installed from the official cargo registry.
You can set this to a different registry name if you have a custom feed or want to use a different source.
Please follow the cargo alternative registries documentation to configure your registry.
Tool Options
The following tool-options are available for the cargo backend—these go in [tools] in mise.toml.
When cargo-binstall is available, mise uses it for registry installs unless a tool option needs cargo install to build from source.
For options that do not skip cargo-binstall, any source-build fallback is handled by cargo-binstall itself. mise does not perform an additional compile fallback after cargo-binstall fails.
| Option | cargo-binstall behavior |
|---|---|
features | Skips cargo-binstall; requires cargo install --features. |
default-features = false | Skips cargo-binstall; requires cargo install --no-default-features. |
bin | Passed through to cargo-binstall; does not skip it. |
crate | Does not skip cargo-binstall when applicable. Git installs always use cargo install. |
locked | Passed through to cargo-binstall; does not skip it. |
install_env
Set environment variables for the cargo install or cargo-binstall command:
[tools]
"cargo:eza" = { version = "latest", install_env = { CARGO_NET_GIT_FETCH_WITH_CLI = "true" } }features
Install additional components (passed as cargo install --features):
[tools]
"cargo:cargo-edit" = { version = "latest", features = "add" }This option requires cargo install; mise skips cargo-binstall when it is set.
default-features
Disable default features (passed as cargo install --no-default-features):
[tools]
"cargo:cargo-edit" = { version = "latest", default-features = false }Setting this to false requires cargo install; mise skips cargo-binstall in that case.
bin
Select the CLI bin name to install when multiple are available (passed as cargo install --bin):
[tools]
"cargo:https://github.com/username/demo" = { version = "tag:v1.0.0", bin = "demo" }This option is supported by cargo-binstall, so it does not cause mise to skip cargo-binstall.
crate
Select the crate name to install when multiple are available (passed as cargo install --git=<repo> <crate>):
[tools]
"cargo:https://github.com/username/demo" = { version = "tag:v1.0.0", crate = "demo" }This option does not cause mise to skip cargo-binstall when applicable. Git installs already use cargo install.
locked
Use Cargo.lock (passes cargo install --locked) when building CLI. This is the default behavior, pass false to disable:
[tools]
"cargo:https://github.com/username/demo" = { version = "latest", locked = false }This option does not cause mise to skip cargo-binstall; it only affects the install if cargo-binstall itself falls back to compiling with cargo install.