39
14
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?
39
14
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?
35
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.
7
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
Separate the sudo rm -rf long command into serveral short command works really good for me. – Kevin Tong – 2014-09-03T16:15:20.477
@frumbert I know it has been 2 years since your comment date. However for further reference, let me tell my story. Macports was running on my OSX Yosemite system which I upgraded to El Capitan. Then, I decided to remove macports completely. For this, I reinstalled macports for El Capitan, then I followed what is told in the above answer. Hope this can help someone ;-) – Lashae – 2015-12-30T16:10:58.987
3Can you summarize what is at the link in your answer in case the link goes dead? – jonsca – 2013-08-13T07:15:09.080
2Everywhere 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 – 2013-12-02T21:27:00.127
Does this help: http://stackoverflow.com/questions/9694395/sudo-port-command-not-found ?
– Quentin – 2013-12-02T21:59:00.763
1
Note that macports also creates its own user and group (see https://trac.macports.org/ticket/31013 ) and removing them is described over in https://apple.stackexchange.com/questions/317576/how-to-delete-macports-user-after-using-the-migration-assistant . Also note that installed ports may themselves may create new users and groups...
– Anon – 2018-09-27T08:53:25.287@Anon Wow, what a mess, glad that I switched to Homebrew years ago. – slhck – 2018-09-27T10:00:29.600
@slhck ... :-) Could you add a note to your answer that there might still be a left over macports user and group after your uninstall steps if you think it might help someone? – Anon – 2018-09-27T12:35:03.777
@Anon Sure, done! – slhck – 2018-09-27T13:10:23.277
I did this and:
$ brew doctor
gives:Warning: Setting DYLD_LIBRARY_PATH can break dynamic linking. You should probably unset it.
– Devin G Rhode – 2012-11-09T08:22:25.090Interesting. Did you ever set it? Like, in the bash profile, bashrc, etc? – slhck – 2012-11-09T08:45:51.523
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 – 2012-11-09T16:57:10.963
It could have also been some rake or rails stuff, but I highly doubt it. – Devin G Rhode – 2012-11-09T16:57:39.760
Hm, unfortunately I've never used MacPorts so I'm not quite familiar with it, but setting the
DYLD_LIBRARY_PATH
for MySQL is pretty common indeed and probably required (?). You're not running Homebrew and MacPorts parallely, are you? In any case, it's just a warning, so unless you encounter specific errors it's best to leave it as-is. That being said, you should probably unsetDYLD_LIBRARY_PATH
if you really don't need it. I'm pretty sure it's in some way connected to MySQL or your .bashrc, .profile, etc. since this isn't set by default. – slhck – 2012-11-09T17:49:42.300what about getting rid of /opt/local?? – Chet – 2014-04-15T00:38:52.423
@Chet The above commands will remove said directory. – slhck – 2014-04-15T05:02:00.230
isn't there stuff in there besides macports? – Chet – 2014-04-15T07:23:48.527
1@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 – 2014-04-15T07:24:36.690