Switching from MacPorts to Homebrew

Decided I'd give Homebrew a try - here's the process I used to switch over.

Make a list of your ports for reference later:

port installed > ports.txt

Might be worth going through that list, clear out the dependency ports you can identify and leave a list of the important applications you want to re-install using Homebrew.

Now uninstall all your ports:

sudo port -f uninstall installed

Now you can clean up the leftover cruft from MacPorts: (might want to check /opt/local first to make sure there isn't any other applications you want to keep, like MySQL)

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

MacPorts probably inserted /opt/local/bin into your $PATH by adding some lines to your ~/.profile. Go ahead and remove those.

Now install Homebrew per the instructions at http://brew.sh. You can find alternate instructions here.

ruby -e "$(curl -fsSL https://raw.github.com/Homebrew/homebrew/go/install)"

Some optional steps before you start re-installing from the list of ports you created earlier. Run brew doctor to make sure there aren't any issues with your system.

brew doctor

Perhaps more importantly, make an account on http://github.com and create a Personal Access Token so that Homebrew doesn't exceed the number of anonymous requests is allows from a single host during a short period of time. Then insert that information into your .profile:


Make sure source your .profile after or run the export command in your current shell if your going to start running brew commands right away.

That's pretty much it.