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?


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”
| improve this answer | |
  • That worked for me, too bad port doesn't handle dependency updates to postgres84 automatically though. – Dana the Sane Dec 8 '09 at 14:09
  • 2
    @Dana the Sane If you mean removing packages that depend on postgres84 automatically, you can use the --follow-dependents argument. – Nick Dec 13 '11 at 5:26
  • @Nick I'll try that next time I uninstall something. – Dana the Sane Dec 13 '11 at 5:54
  • The second approach works fine for me, but the first one with -u seems to give the same warning about multiple versions being installed as if I hadn't used -u at all – matt b Oct 11 '13 at 20:12
  • These commands don't work (on Mac OSX Mavericks). – bzero Jan 14 '14 at 17:19
sudo port uninstall inactive

This will remove your inactive ports.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.