18

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?

21

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.

  • 5
    Just make absolutely sure the first line ends in a backslash and not a forward slash! – echristopherson Feb 22 '13 at 4:51
  • True that. I'll add it in my answer. – Michiel Feb 22 '13 at 7:31
  • I got this error Error: No ports matched the given expression when used sudo port -fp uninstall installed. What might be the possible reason? – ptamzz Mar 15 '14 at 18:32
  • thnaks for the answer, what I was looking for, I got from here. Great!!! – AMIC MING Mar 3 '16 at 18:59
  • Is /opt/local used for anything besides MacPorts? If so, this seems dangerous.... – jvriesem May 5 '17 at 20:18

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .