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?
2 Answers
From the manual, uninstalling MacPorts works as follows. You need to first uninstall all ports:
sudo port -fp uninstall --follow-dependents installedIf 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 ~/.macportsWarning: 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.
13This guide helped me remove MacPorts:
Here's a summary (in case the link goes dead): First, uninstall MacPorts:
sudo port -f uninstall installedSecond 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 ~/.macportsAfter that you should remove the /opt/local/bin from your $PATH
5