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

So I haven't cleaned up after MacPorts in, um, ever and I'm trying to cut down on the disk space it's using. The source code for several (but not all) of the ports are still on my disk. Since I've already compiled and installed those ports, is there any reason to keep the source? How can I get MacPorts to remove the source and just keep the compiled binaries? (Or is that the intended behavior; am I finding ports that don't properly clean their sources?)

I've done port uninstall inactive and port clean --all installed. They both greatly helped clean up other stuff, but neither of them got rid of the source code.


share|improve this question
up vote 10 down vote accepted

Where are you looking for this source code? MacPorts downloads source packages and stores them in /opt/local/var/macports/distfiles. If you did port clean --all installed then your system should have gotten rid of these source pacakges. You may do better to run port clean --all all to get rid of source packages of software that you may have uninstalled.

However, if you're talking about files stored in /opt/local/var/macports/sources, those are not source packages. Those are the actual MacPorts portfiles, which contain the info for all available ports, including dependencies and build instructions for the port command. Running port clean would not touch that directory.

share|improve this answer
So the files I was asking about are in /opt/local/var/macports/software. That's where the installed files go; apparently some ports install .c files. (That was news to me.) Thanks for pointing me in the right direction. – Evan Nov 15 '10 at 18:18
Ah, I see. If you want to verify what files come with a port, you can use port contents <portname>. The .c files should show up, indicating that they are meant to be installed, and not just from the source package. – fideli Nov 15 '10 at 19:27

You can remove leaf packages as well, but you should examine your existing leaves before uninstalling any of them.

port echo leaves

Some common leaves (automake, gperf, libtool, pkgconfig) are build-time dependencies of common ports, so you may want to “request” them (sudo port setrequested port1 port2 port3 …) to avoid uninstalling them just to have to reinstall them later.

You can uninstall any remaining leaves quite easily:

sudo port uninstall leaves

taken (plagiarized) from:

share|improve this answer

You must log in to answer this question.

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