mise/Q/How do I list installed mise tools that aren't in any config file?
Properties
- logseq-entity
- Logseq/Entity/Question
- see-also
- mise, mise/ls, mise/ls/--installed, mise/uninstall, mise/Task/File, mise/Task/File/Group, usageCLI/spec, mise/Q/How do I remove a mise tool?, mise/Q/What's the difference between mise unuse, mise uninstall, and mise cache clear?, chezmoi
How do I list installed mise tools that aren't in any mise/Config/mise.toml (or other config) file?
My Answer
- use user-defined mise/Task/Files
- for installation, put in mise/Config/mise.toml/Global
AI Answer
- Short answer: Orphan installs are on disk but not pinned in any merged config—
mise ls --installedshows a blank config column, and JSON hassource: null(or emptysource.path). Use global mise/Task/File tasks:mise run tool:missing:lsto listTOOL@VERSIONlines, preview withmise run tool:missing:uninstall -- --preview, thenmise run tool:missing:uninstallto remove. Use mise/uninstall, not mise/unuse (config-only). - Chezmoi source: Managed in dotfiles at
chezmoi/dot_config/mise/tasks/tool/missing/(executable_ls→~/.config/mise/tasks/tool/missing/ls,executable_uninstall→…/uninstall). Apply withchezmoi apply. - Tasks (under
~/.config/mise/tasks/tool/missing/, grouptool:missing:*per mise/Task/File/Group): - Do not use
--dry-runon the task:mise run --dry-runis a runner flag (“print the command, don't execute”). It collides with a task flag named--dry-runand produces only a line like[tool:missing:uninstall] $ …/uninstall --dry-runwith no output. The task uses--previewinstead (usageCLI/spec#USAGE flag "-n --preview"). - Task sources
tool/missing/ls:tool/missing/uninstall:- bash
#!/usr/bin/env bash set -euo pipefail #MISE description="Uninstall mise tools not referenced in any config" #USAGE flag "-n --preview" help="List orphans only; do not uninstall" orphan_specs() { mise ls --installed --json | jq -r ' to_entries[] | .key as $tool | .value[] | select(.source == null or (.source.path // "") == "") | "\($tool)@\(.version)" ' } orphans=() while IFS= read -r line; do [[ -n "$line" ]] && orphans+=("$line") done < <(orphan_specs) if [[ ${#orphans[@]} -eq 0 ]]; then echo "No orphan tools installed." exit 0 fi preview=false [[ "${usage_preview:-false}" == "true" || "${usage_n:-false}" == "true" ]] && preview=true if $preview; then printf '%s\n' "${orphans[@]}" exit 0 fi exit_code=0 for spec in "${orphans[@]}"; do echo "Uninstalling ${spec}..." if ! out=$(command mise uninstall "$spec" 2>&1); then printf '%s\n' "$out" >&2 echo "error: failed to uninstall ${spec}" >&2 exit_code=1 elif [[ -n "$out" ]]; then printf '%s\n' "$out" fi done remaining=() while IFS= read -r line; do [[ -n "$line" ]] && remaining+=("$line") done < <(orphan_specs) if [[ ${#remaining[@]} -gt 0 ]]; then echo "Still installed (not removed):" >&2 printf ' %s\n' "${remaining[@]}" >&2 exit 1 fi if [[ $exit_code -ne 0 ]]; then exit "$exit_code" fi echo "Uninstalled ${#orphans[@]} orphan(s)."
- Related:
mise ls --currentis the inverse (config-only).mise ls --prunableis for stale versions of pinned tools (mise/Q/What's the difference between mise unuse, mise uninstall, and mise cache clear?). mise ls
- Short answer: Orphan installs are on disk but not pinned in any merged config—