How to cleanly remove MacPorts

I'd like to cleanly remove all changes made by MacPorts as well as MacPorts itself, to try my luck with homebrew. How can I do that?


The MacPort documentation advises to use your Terminal and type:
sudo port -fp uninstall installed

and with this command, all remaining items will be deleted:

sudo rm -rf /opt/local
sudo rm -rf /Applications/DarwinPorts
sudo rm -rf /Applications/MacPorts
sudo rm -rf /Library/LaunchDaemons/org.macports.*
sudo rm -rf /Library/Receipts/DarwinPorts*.pkg
sudo rm -rf /Library/Receipts/MacPorts*.pkg
sudo rm -rf /Library/StartupItems/DarwinPortsStartup
sudo rm -rf /Library/Tcl/darwinports1.0
sudo rm -rf /Library/Tcl/macports1.0
sudo rm -rf ~/.macports

Warning: Don't run a sudo command, especially a rm -rf one, unless you know what it's doing.