You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've had a conversation on our community Discord server.
Feature request
Implement a sdk clean subcommand that removes installed SDK versions no longer referenced by any .sdkmanrc file — i.e., orphaned versions that have accumulated over time.
This is analogous to brew autoremove for SDKMAN! candidates: it identifies versions that are installed but not pinned by any project configuration, and removes them to recover disk space.
Proposed behaviour
Scan all .sdkmanrc files found under a configurable base directory (e.g. ~/)
Collect the union of all candidate versions referenced
Compare against all currently installed versions
Prompt the user to confirm removal of any installed versions not referenced by any .sdkmanrc
Optionally support a --dry-run flag to list what would be removed without acting
Always protect the current default version of each candidate, even if it is not referenced by any .sdkmanrc file — so if .sdkmanrc pins java=21.0.10-tem and the default is 17.0.18-tem, both are kept; only versions that are neither referenced nor the default are candidates for removal
Note: this is intentionally separate from sdk flush, which handles temporary files and caches under $SDKMAN_DIR/tmp and $SDKMAN_DIR/var. sdk clean operates on installed candidate versions only.
Activity
marc0der commentedon Mar 5, 2026
Also worth noting that the
archivesdirectory is a remnant of the past, and modern SDKMAN! installations don't have that directory anymore.