I tried to install the xfce package on MacPorts, which has about a hundred dependencies. It got pretty far, but ultimately the install failed due to whatever reason, about 85 dependencies in. So I'd like to uninstall the entire thing, in particular the 85 useless dependencies which I no longer need.

The problem is that if I try sudo port uninstall xfce, it doesn't do anything. Neither does sudo port uninstall --follow-dependencies xfce, sudo port uninstall --follow-dependents xfce and so on. From what I can tell, this seems to be because MacPorts doesn't think that xfce is installed at all, since the installation never finished, so it doesn't try to uninstall anything. I've also tried sudo port clean --all installed and it didn't seem to do much.

What did do something is scrolling up to the beginning, when I tried to install the package, and looking at the list of dependencies it said it was going to install and manually uninstalling each one. For instance, I scrolled up to this:

$ sudo port install xfce
--->  Computing dependencies for xfce
The following dependencies will be installed:

And then typed sudo port uninstall Thunar apr apr-util at-spi2-atk at-spi2-core atk ...

which did it. But is there some better way to do this?


1 Answer 1


Macports tracks if a port was explicitly requested by you (ie an argument to port install) or if it was loaded because another port needed it.

To clean up you need two stages.

  1. Remove the xfce port by port uninstall and port clean. But if one of the ports xfce failed then this step is not needed as nothing of xfce was acted on.

  2. Remove all the unrequested and unneeded ports. This is all in the Macports Guide

    The unrequested can be seen by port list unrequested but this includes ones that might be required by other ports.

    The command that lists all the ports that you have not requested and don't have ports dependent on them is port echo leaves You then need to uninstall these.

    Luckily there is code to do this but not as part of the base Macports install. You need to install a package and then run it. sudo install port_cutleaves and then sudo port_cutleaves This finds the current leaves and asks if you want to uninstall each one in turn. When that has done it then asks if you want to uninstall a new set of leaves that have been uncovered.

You must log in to answer this question.

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