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

3 Responses to “Clean up all inactive MacPorts package”

  1. Jeff Says:

    You can get the same effect via:

    $ sudo port -u uninstall

    • a/caro Says:

      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.

  2. ejel Says:

    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.


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.