34

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?

2 Answers 2

41

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”
7
  • That worked for me, too bad port doesn't handle dependency updates to postgres84 automatically though. Dec 8, 2009 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, 2011 at 5:26
  • @Nick I'll try that next time I uninstall something. Dec 13, 2011 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, 2013 at 20:12
  • These commands don't work (on Mac OSX Mavericks).
    – bzero
    Jan 14, 2014 at 17:19
46
sudo port uninstall inactive

This will remove your inactive ports.

You must log in to answer this question.

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