MacPorts: How to clean out source code

6

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.

Thanks.

Evan

Posted 2010-11-13T22:13:08.153

Reputation: 63

Answers

12

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.

fideli

Posted 2010-11-13T22:13:08.153

Reputation: 13 618

1So 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 – 2010-11-15T18:18:49.053

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 – 2010-11-15T19:27:29.657

2

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:

https://apple.stackexchange.com/questions/10149/how-to-remove-unused-macports-packages

vossman77

Posted 2010-11-13T22:13:08.153

Reputation: 121