Clean Re-Installation of MacPorts under Snow Leopard

Since I’ve upgraded from Leopard to Snow Leopard, I had trouble using MacPorts until I cleaned it all up and did a fresh re-install – which really helped. Here’s the way to go:

First of all, re-install the MacPorts.dmg. After that, check what packages you’ve got installed and activated:

$ port installed | grep -i active

You can save this list by redirecting it’s output via > to any file. Next, clean up the ports:

$ sudo su -
Password:
# port clean all

Next, uninstall *all* installed (even not activated) ports:

# sudo port -f uninstall installed

And last but not least, look at your list, check what software you still need and re-install it:

# port install

You could try to automate the re-installation by something like:

# port install $(cat ./file_containing_list.txt | awk ‘{ print $1 }’ | while read line; do echo -n “$line “; done)

Although I would not recommend it, since you’d like to install different variants on some ports. :-)

Enjoy.


About this entry