"Reclaiming disk space" documentation/guide missing

Ryan Schmidt ryandesign at macports.org
Sat May 23 15:12:50 PDT 2009

On May 23, 2009, at 12:24, Andreas Kotes wrote:

> I really love MacPorts (thanks to everyone maintaining it!), but I've
> got a little request: Macports is using an awful lot of disk space  
> once
> you've got everything properly downloaded, built, installed, etc - in
> most cases, it seems to clean up after itself, but there seem to be
> things lurking behind - distfiles, old versions, things that aren't  
> used
> during runtime and could be created from scratch pretty fast, etc ...
> I'd suggest to document how to get rid of as many of these files  
> and as
> possible, or even to add a command to 'port' that takes care of  
> this for
> the user.

You're right, documentation could probably be enhanced on this topic.

But port commands do exist for this.

To remove all ports' distfiles:

sudo port clean --distfiles all

You might also have old work directories lying around if a build ever  
failed. To nuke work directories and distfiles at once:

sudo port clean --all all

To remove old versions of installed ports:

sudo port uninstall inactive

To uninstall old versions of a port at the same time that you upgrade  
to the new version:

sudo port -u upgrade <portname>

You're right there are ports that are only needed at build time and  
could be removed after the build is complete. You may also have ports  
installed that are no longer needed. Maybe a dependency got removed  
from a port somewhere along the way. The port_cutleaves tool can help  
you find and remove these.

sudo port install port_cutleaves
man port_cutleaves
sudo port_cutleaves

> Also, getting rid of unneded localization data (semi)automatically  
> would
> help a lot ...

There isn't a supported way to do this. Localization data, if any,  
would be registered to the port, and you should not remove files  
which are registered to a port (though probably nothing terribly bad  
will happen if you do). Ports should be encouraged to provide as much  
localization data as possible, to provide the fullest installation  

> Yes, I know disk space is comparatively cheap (well, not with SSDs,  
> but
> ..), but nonetheless I tend to use all of it on any of my systems, so
> I'm very concious about what's biiiig ... Right now, MacPorts is using
> almost a gigabyte on my system, which is quite a lot for something
> that's "only" complementing an existing Unix-system - with a
> comparatively small amount of installed packages.

My MacPorts prefix currently takes 2.5GiB on this machine, and I've  
recently nuked most of my distfiles, and I don't keep old versions  
installed either. :) Some ports are just... big! Looking on my  
machine, llvm and gcc43 occupy 250MiB of space each, and ghc takes  
over 400MiB (that's installed, not counting space for distfiles or  
work directory).

Note that MacPorts is not trying to complement your existing UNIX  
software on Mac OS X; it's trying to replace it. MacPorts goes to  
considerable lengths not to use the components provided by Mac OS X,  
for the reasons explained here:


So when using MacPorts you can expect some level of redundancy in the  
ports that are installed.

More information about the macports-users mailing list