How to uninstall MacPorts on Mac OS X

Uninstalling MacPorts can be very easy, you basically need just two commands to get the work done. Before removing MacPorts, please make sure the removal won’t cause any trouble. Depending on the issue you are experiencing, you may not need to do so. If you are unsure, ask on the macports-users mailing list first.

First we need to uninstall all the installed ports.

With the command “port installed”, it lists all the installed ports, please go through them and make sure you don’t need any of them again. Then the batch uninstall can be done with below command:

$ sudo port -fp uninstall installed

All that will be left in your installation prefix now will be files that were not registered to any port. This includes configuration files, databases, any files which MacPorts renamed in order to allow a forced installation or upgrade, and the base MacPorts software itself. You may wish to save your configuration files (most are in ${prefix}/etc), databases, or any other unique data by moving it aside.

To remove all remaining traces of MacPorts, run the following command in the Terminal, suppose you haven’t changed prefix, applications_dir or frameworks_dir, otherwise use correct paths respectively.

$ 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 \
~/.macports

Note that depending on which version of MacPorts you have and which ports you have installed, not all of the above paths will exist on your system. This is OK.

Share Button

Leave a comment

Your email address will not be published. Required fields are marked *