Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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?

share|improve this question
up vote 36 down vote accepted

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”
share|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
@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.

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .