Today I Learned: collection of notes, tips and tricks and stuff I learn from day to day working with computers and technology as a developer

View project on GitHub

Uninstall MacPorts

This is the quick guide to delete MacPorts:

sudo port -fp uninstall installed
$ sudo rm -rf \
        /opt/local \
        /Applications/DarwinPorts \
        /Applications/MacPorts \
        /Library/LaunchDaemons/org.macports.* \
        /Library/Receipts/DarwinPorts*.pkg \
        /Library/Receipts/MacPorts*.pkg \
        /Library/StartupItems/DarwinPortsStartup \
        /Library/Tcl/darwinports1.0 \
        /Library/Tcl/macports1.0 \

And finally you have to remove the MacPorts user (macports) and group if present.

Check for presence of macports user

$  dscl . list /Users | grep -v '^_'

Delete the user

$ sudo /usr/bin/dscl . -delete "/Users/macports"

Check for the presence of the macports group group

$ sudo dscl . -delete "/Groups/macports"

Source: MacPorts

Source: StackExchange