Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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?

share|improve this question
add comment

2 Answers 2

up vote 14 down vote accepted

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 it to Terminal):

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 \

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 (e.g. sudo rm -rf /Applications/DarwinPorts, then sudo rm -rf /Library/LaunchDaemons/org.macports.*).

share|improve this answer
I did this and: $ brew doctor gives: Warning: Setting DYLD_LIBRARY_PATH can break dynamic linking. You should probably unset it. –  Devin G Rhode Nov 9 '12 at 8:22
Interesting. Did you ever set it? Like, in the bash profile, bashrc, etc? –  slhck Nov 9 '12 at 8:45
No, BRAND NEW OS install too, this is something macports did, I think. However, echo $DYLD_LIBRARY_PATH spits out paths to a mysql binary –  Devin G Rhode Nov 9 '12 at 16:57
It could have also been some rake or rails stuff, but I highly doubt it. –  Devin G Rhode Nov 9 '12 at 16:57
@Chet Unless you put something there, no. /opt/ does not even exist in a default OS X installation, so you can safely remove it. –  slhck Apr 15 at 7:24
show 4 more comments

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

share|improve this answer
Can you summarize what is at the link in your answer in case the link goes dead? –  jonsca Aug 13 '13 at 7:15
Everywhere I look, there's "if you have a working port command, then use sudo port blah". What if, like in my case, port isn't working? –  frumbert Dec 2 '13 at 21:27
add comment

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.