"Reclaiming disk space" documentation/guide missing

Andreas Kotes count-macports at flatline.de
Mon May 25 09:57:25 PDT 2009

Hi Ryan,

* Ryan Schmidt <ryandesign at macports.org> [20090524 00:13]:
> 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.

thanks for agreeing :)

> But port commands do exist for this.

ok, let's try .. starting at 1005280k ..

> To remove all ports' distfiles:
> sudo port clean --distfiles all

Putorius:~ count$ sudo port clean --distfiles all
Error: clean does not accept --distfiles

oops. (MacPorts 1.710) ... --dist seems to be it ;)

.. brings me down to 900384k ..

> 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

.. brings me down to 877124k ..

> To remove old versions of installed ports:
> sudo port uninstall inactive

.. brings me down to 564356k - yay!

> To uninstall old versions of a port at the same time that you upgrade to 
> the new version:
> sudo port -u upgrade <portname>

okay, this seems to be it - I'd like to strongly suggest making this the
default for non-developers ...

> 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

okay, this leaves me at 561884 - not much dramatic/really unneeded

Documenting all this would really help others, I think :)

>> 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 possible.

I totally agree. Debian solves this by offering a 'localepurge' package,
which basically allows you to give a list of languages you need (i.e.
which are useful to you ;)), and just has a install-hook which takes
care of throwing away all other localization files.

Though, it's description reads:

Description: Automagically remove unnecessary locale data
 This is just a simple script to recover diskspace wasted for unneeded
 locale files and localized man pages. It will automagically be invoked
 upon completion of any apt installation run.

 Please note, that this tool is a hack which is *not* integrated with
 Debian's package management system and therefore is not for the faint
 of heart. This program interferes with the Debian package management
 and does provoke strange, but usually harmless, behaviour of programs
 related with apt/dpkg like dpkg-repack, debsums, reportbug, etc.
 Responsibility for its usage and possible breakage of your system
 therefore lies in the sysadmin's (your) hands.

 Please definitely do abstain from reporting any such bugs blaming
 localepurge if you break your system by using it. If you don't know
 what you are doing and can't handle any resulting breakage on your own
 then please simply don't use this package.

same problems/concerns, solved with a disclaimer. Maybe worth

> 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).

ugh ;)

> 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:
> http://trac.macports.org/wiki/FAQ#WhyisMacPortsusingitsownlibraries
> So when using MacPorts you can expect some level of redundancy in the  
> ports that are installed.

okay, good to know! - thanks for the help :)


In theory, theory and practice are the same. In practice, they’re not.
- Lawrence Peter "Yogi" Berra

More information about the macports-users mailing list