I have installed MacPorts on my Mac OS X Lion, and I would like to remove it. There should be no more trace of MacPorts?
Is there a way to do this?
From the manual, uninstalling MacPorts works as follows. You need to first uninstall all ports:
sudo port -fp uninstall --follow-dependents installed
If port
is not found, try /opt/local/bin/port
instead.
Also, to remove remainders of MacPorts, you will need to delete the following files by this single command (copy and paste line-by-line to Terminal):
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, and enter each line individually if you're unsure.
Note that MacPorts creates its own user and user group. They can be removed, too. See this answer over on Ask Different for more info.
Finally, each port installed through MacPorts may again create its own user and group, so you may have to perform a manual cleanup.
$ brew doctor
gives: Warning: Setting DYLD_LIBRARY_PATH can break dynamic linking. You should probably unset it.
Nov 9, 2012 at 8:22
/opt/
does not even exist in a default OS X installation, so you can safely remove it.
This guide helped me remove MacPorts: http://bitboxer.de/2010/06/03/moving-from-macports-to-homebrew/
Here's a summary (in case the link goes dead): First, uninstall MacPorts:
sudo port -f uninstall installed
Second step: remove everything that is left from MacPorts (check for MySQL and other stuff in /opt/local first):
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
After that you should remove the /opt/local/bin from your $PATH