How to uninstall all unused versions of a macports package at once
When maintaining macports packages, I prefer to remove old packages when I replace them with new ones. However, over time as packages are upgraded, you end up with problems like:
$ sudo port uninstall -f postgresql83
---> The following versions of postgresql83 are currently installed:
---> postgresql83 @8.3.3_0
---> postgresql83 @8.3.7_0
---> postgresql83 @8.3.8_1 (active)
Error: port uninstall failed: Registry error: Please specify the full version as recorded in the port registry.
Is there a macports command to remove all versions of a package at once?
Solution 1:
If you want to uninstall all the old (non-active) versions try this:
port -y -u uninstall
# if you like what you see, change “port -y” to “sudo port”
If you mean that you want to uninstall all the versions (non-active and active) of (e.g.) the postgresql83
port, then try this:
port -y uninstall installed and postgresql83
# if you like what you see, change “port -y” to “sudo port”
Solution 2:
sudo port uninstall inactive
This will remove your inactive ports.