mise prune
- Usage:
mise prune [FLAGS] [INSTALLED_TOOL]… - Effect: destructive — may delete or irreversibly overwrite
- Source code:
src/cli/prune.rs
Delete tool versions that nothing uses
mise records each config file it loads (in ~/.local/state/mise/tracked-configs) and each tool stub it runs (in ~/.local/state/mise/tracked-stubs). mise prune deletes installed versions that none of them selects. A config that requests node = "20" keeps only the 20.x version it resolves to. Versions installed only for mise exec <TOOL>@<VERSION> or through MISE_<TOOL>_VERSION are deleted. Versions that a running process was started from are kept, so a long-running program keeps its files.
It also forgets tracked, trusted, and ignored config files that no longer exist; without it, mise forgets a missing tracked file a week after its last use, and one unused for prune.forget_unused_after. Pass --tools or --configs to do only one of the two. List the versions it would delete with mise ls --prunable.
Versions in the system installs directory (see mise install --system) are left alone unless you pass --system, which prunes that directory instead of your own. mise only knows the config files your user has loaded, so preview with --dry-run first: another user's project may need a version that none of them names.
Arguments
[INSTALLED_TOOL]…— Prune only these tools
Flags
-n --dry-run— Show what would change without changing anything--configs— Only forget tracked, trusted, and ignored config files that no longer exist--dry-run-code— Like --dry-run, but exit with code 1 if there are tools to pruneUse it in scripts that check whether tools need pruning.
--system— Delete unused versions from the system installs directory instead of your ownA version is kept when a config file your user has loaded, such as the system config, still selects it, or when a process you can inspect runs from it. Config files of other users are not known. mise uses
sudowhen it cannot write to the directory. Implies--tools.--tools— Only delete unused tool versions-h --help— Print help
Examples
Preview what would be deleted and why
mise prune --dry-run
mise node@20.0.0 is prunable: node is required at 20.19.5 by ~/src/app/mise.toml
mise node@20.0.0 [dryrun] remove ~/.local/share/mise/installs/node/20.0.0, ~/.cache/mise/node/20.0.0Delete unused node versions only
mise prune --tools nodePreview unused versions in the system installs directory
mise prune --system --dry-run