Uninstall all but one Daml SDK?

If I do a daml version, I see lots of versions:

> daml version
SDK versions:
    :
  2.8.3
  2.9.4
  2.10.0-snapshot.20241016.0
  3.2.0-snapshot.20241009.0   (default SDK version for new projects)

How can I uninstall all but one of those?
(aside from manually uninstalling one at a time?)

On macOS:

  1. Set the Daml Assistant to the version you want to keep. For example:

    daml install 2.9.4 --install-assistant yes
    
  2. Double-check:

    > daml version --assistant yes
    SDK versions:
      2.8.3
      2.9.4                       (daml assistant version)
      2.10.0-snapshot.20241016.0
      3.2.0-snapshot.20241009.0   (default SDK version for new projects)
    
  3. Uninstall all but the Daml Assistant’s version:

    daml version --assistant yes \
    | grep -v 'daml assistant version' \
    | sed -n -E 's|.*([0-9]+\.[0-9]+\.[0-9]+[^ ]*).*|\1|p' \
    | xargs -I %v -- daml uninstall %v
    
3 Likes