Both Homebrew and MacPorts install command-line tools and software on Mac. Homebrew is the modern standard. Most people should use it.

Quick Comparison

Feature Homebrew MacPorts
Popularity Very popular Less common now
Install location /opt/homebrew or /usr/local /opt/local
Philosophy Uses macOS libraries Self-contained
Install speed Faster (binaries) Slower (compiles)
Package count ~6,000 formulae ~20,000+ ports
Community Very active Active
Modern Mac support Excellent Good

Use Homebrew If...

  • You're new to package managers
  • You want quick, easy installs
  • You follow most tutorials (they assume Homebrew)
  • You want to install GUI apps too (Homebrew Cask)
  • You value simplicity

Use MacPorts If...

  • You need a package not in Homebrew
  • You want completely self-contained installations
  • You do scientific computing
  • You have existing MacPorts infrastructure
  • You prefer compilation from source

Installing Homebrew

/bin/bash -c "\$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

Then:

brew install node
brew install python

Installing MacPorts

Download from macports.org, then:

sudo port install nodejs
sudo port install python311

Note: MacPorts requires sudo. Homebrew doesn't.

Philosophy Difference

Homebrew: Uses libraries that come with macOS when possible. Smaller installations, faster installs, but depends on macOS versions.

MacPorts: Builds its own copies of everything. More self-contained, but larger and slower to install.

Speed

Homebrew downloads pre-compiled binaries (bottles) when available:

brew install ffmpeg  # Usually seconds

MacPorts compiles from source by default:

sudo port install ffmpeg  # Can take 30+ minutes

MacPorts does offer binaries for some packages to speed things up.

GUI Applications

Homebrew can install Mac apps:

brew install --cask visual-studio-code
brew install --cask google-chrome

MacPorts focuses on command-line tools.

Can You Use Both?

Technically yes, but it's not recommended. They can conflict. Pick one and stick with it.

If you need a package only available in one:

  1. Try Homebrew first
  2. If not there, check if there's an alternative
  3. Only use MacPorts if really necessary

My Recommendation

Use Homebrew. It's:

  • The modern standard on Mac
  • What tutorials assume
  • Faster to install packages
  • Simpler to use
  • Supports GUI apps

Unless you have a specific reason for MacPorts, Homebrew is the right choice.

Common Homebrew Commands

brew install <package>    # Install
brew uninstall <package>  # Remove
brew update              # Update Homebrew
brew upgrade             # Upgrade packages
brew list                # See installed
brew search <name>       # Search packages

Common MacPorts Commands

sudo port install <package>    # Install
sudo port uninstall <package>  # Remove
sudo port selfupdate           # Update MacPorts
sudo port upgrade outdated     # Upgrade packages
port installed                 # See installed
port search <name>             # Search packages

Package Availability

Most common tools are in both:

Package Homebrew MacPorts
Python
Node.js
Git
ffmpeg
PostgreSQL

MacPorts has more scientific and niche packages.

Switching from MacPorts to Homebrew

  1. Note your installed ports: port installed
  2. Uninstall MacPorts: follow official uninstall instructions
  3. Install Homebrew
  4. Install packages with Homebrew

It's a clean break - they don't share anything.


Keep Learning

Homebrew makes installing tools trivial. The free course covers Homebrew and essential Terminal skills.

Check it out at Mac Terminal for Humans.