Clean up all inactive MacPorts package
11 May 2010
Today I cleaned up all packages that MacPorts leaves behind, i.e. older package versions that not active yet installed. This is as easy as executing the following from a shell:
for file in `port installed | grep -v active | sed -e "s/ //g"` ; do sudo port uninstall $file ; done
and typing your password. Not that bad for recovering almost 1GB in my root partition.
By the same token, you can get rid of all files created when building like this:
for file in `port installed | sed -e "s/^ *\([^ ]*\) .*/\1/"` ; do sudo port clean --all $file ; done
Advertisement
16 August 2010 at 7:36 am
You can get the same effect via:
$ sudo port -u uninstall
30 August 2010 at 1:17 pm
Thanks for your comment, Jeff…
Anyway, cleaning up the packages has a different effect than uninstalling them.
By executing
$ sudo port -u uninstall
all of your macports packages will be removed, and you will not be able to use them anymore. Cleaning up simply means deleting all the files that were created at build/install time that are not required to effectively use the programs.
30 January 2011 at 12:41 am
I guess what Jeff meant was “sudo port -u uninstall” can be used instead of your first code snippet, which is also to uninstall inactive packages.