Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/dev-tools/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -428,7 +428,7 @@ If you type a command in your shell (e.g., `node`) and it is not found, mise can
- **When it triggers:** When a command is not found in the shell and the handler is enabled.
- **How to control:**
- Setting: [`not_found_auto_install`](/configuration/settings.html#not_found_auto_install) (default: true)
- **Limitation:** Only works for tools that already have at least one version installed, since mise cannot know which tool provides a binary otherwise.
- **Limitation:** mise identifies the provider from the registry's bin metadata, so this covers configured tools even if they have never been installed — but not tools configured by a raw backend spec (e.g. `cargo:some-crate`), which carry no such metadata. Install those explicitly with `mise install`, or `mise x` to install and run in one step. See [troubleshooting](/troubleshooting.html#auto-install-on-command-not-found-does-not-trigger).

::: tip
Disable auto_install for specific tools by setting [`auto_install_disable_tools`](/configuration/settings.html#auto_install_disable_tools) to a list of tool names.
Expand Down
15 changes: 9 additions & 6 deletions docs/troubleshooting.md
Original file line number Diff line number Diff line change
Expand Up @@ -376,15 +376,18 @@ eval "$(mise hook-env)"

See also the [CI/CD section](/tips-and-tricks.html#ci-cd) in Tips & Tricks.

## Auto-install on command not found handler does not work for new tools
## Auto-install on command not found does not trigger

If you are expecting mise to automatically install a tool when you run a command that is not found (using the [`not_found_auto_install`](/configuration/settings.html#not_found_auto_install) feature), be aware of an important limitation:
When you run a command that is not found, mise can install the tool that provides it (the [`not_found_auto_install`](/configuration/settings.html#not_found_auto_install) feature). It maps the command back to a tool using the `bins` metadata in mise's registry, which means a tool that is configured but has never been installed is handled too — not only a missing version of a tool you already have.

**mise can only auto-install missing versions of tools that already have at least one version installed.**
If nothing happens, it is usually one of these:

This is because mise does not have a way of knowing which binaries a tool provides unless there is already an installed (even inactive) version of that tool. If you have never installed any version of a tool, mise cannot determine which tool is responsible for a given binary name, and so it cannot auto-install it on demand.
- **The tool is configured by a raw backend spec.** `"cargo:some-crate" = "1.0.0"` or `"ubi:owner/repo" = "1.0.0"` is not a registry entry, so it carries no bin metadata and nothing connects the command you typed to it.
- **The tool is not configured at all.** The handler only installs tools your config already asks for in the current directory; it will not pick a tool for a command you have never declared.
- **The feature is off for that tool** — either [`not_found_auto_install`](/configuration/settings.html#not_found_auto_install) is `false`, or the tool is listed in [`auto_install_disable_tools`](/configuration/settings.html#auto_install_disable_tools).

**Workarounds:**

- Manually install at least one version of the tool you want to be auto-installed in the future. After that, the auto-install feature will work for missing versions of that tool.
- Use [`mise x|exec`](/cli/exec) or [`mise r|run`](/cli/run) to trigger auto-install for missing tools, even if no version is currently installed. These commands will attempt to install the required tool versions automatically.
- Where a registry entry exists, refer to the tool by its registry name (`ripgrep`) rather than by a raw backend spec (`ubi:BurntSushi/ripgrep`), so the handler can map the command to it.
- Otherwise install it explicitly instead of on demand: `mise install`, or [`mise x|exec`](/cli/exec) to install and then run something in one step. Both materialise the whole configured toolset, so the backend does not matter. [`mise r|run`](/cli/run) does the same, but only as part of running a task.
- Installing once by hand is enough to make the handler work from then on: with a version present, mise can also discover the mapping from the installed executables.
17 changes: 12 additions & 5 deletions settings.toml
Original file line number Diff line number Diff line change
Expand Up @@ -1785,11 +1785,18 @@ docs = """
Set to false to disable the "command not found" handler to autoinstall missing tool versions.
Disable this if experiencing strange behavior in your shell when a command is not found.

**Important limitation**: This handler only installs missing versions of tools that already have
at least one version installed. mise cannot determine which tool provides a binary without having
the tool installed first, so it cannot auto-install completely new tools.

This also runs in shims if the terminal is interactive.
The handler works out which tool provides a command from the `bins` metadata in mise's registry, so
it can install a tool that is configured but has never been installed — not only a missing version
of a tool you already have.

**Limitation**: this only covers tools mise's registry knows. A tool configured by a raw backend
spec (`ubi:owner/repo`, `cargo:…`, `npm:…`) carries no bin metadata, so a command name cannot be
traced back to it. Install those explicitly instead — `mise install`, or [`mise x`](/cli/exec) to
install and run in one step — since both materialise the whole configured toolset whatever the
backend. The tool also has to be configured in a config file that applies to the current directory:
mise will not install something you have not asked for.

This also runs in shims.
"""
env = "MISE_NOT_FOUND_AUTO_INSTALL"
type = "Bool"
Expand Down
Loading