How to download and install MacPorts on Mac

MacPorts is a free, open-source package manager that installs thousands of command-line tools and libraries on a Mac. Here is what to install first, which installer fits your macOS and how to install and update ports in Terminal.

MacPorts

  • A separate installer for each macOS
  • Apple Silicon and Intel
  • Free, open source

The links go to the developer’s website (macports.org, github.com). MacWashing is not affiliated with the developer and keeps no installers.

Before you start

You need an administrator account on your Mac. MacPorts asks for Apple’s Command Line Tools first. Install them with this command in Terminal and click Install in the window that opens:

xcode-select --install

Full Xcode is optional: MacPorts tells you if a port needs it to build from source.

Don’t mix MacPorts with Homebrew without a reason. MacPorts lives in /opt/local and Homebrew in its own folder, but when MacPorts builds from source, its tools can pick up Homebrew’s libraries, especially from /usr/local, and builds fail in strange ways. MacPorts’ developers advise using one package manager.

How to install MacPorts

MacPorts has a separate .pkg installer for each macOS version. Check yours in Apple menu › About This Mac, then download the matching installer on macports.org/install.php: Tahoe, Sequoia, Sonoma, or an older system from the list of legacy installers.

  1. Open the downloaded MacPorts-….pkg in your Downloads folder.
  2. Click Continue, accept the license agreement and click Install.
  3. Enter your Mac password and click Install Software. The installer also updates MacPorts and its list of ports, so it can take a few minutes.
  4. When it’s done, click Close and open a new Terminal window: the installer adds MacPorts to your shell settings, and only new windows see it.

Take the installer only from macports.org: a .pkg installs with administrator rights.

Install and update ports

Update MacPorts and its list of ports first, and then regularly:

sudo port -v selfupdate

Then install what you need, for example wget:

sudo port install wget
  • Find the exact name of a port, for example: port search wget
  • Update everything you installed: sudo port upgrade outdated
  • Remove old versions left after upgrades and free space: sudo port uninstall inactive
  • The installer. Move the .pkg from Downloads to the Trash once MacPorts works.

If MacPorts won’t install or work

  • Terminal says «port: command not found». Open a new Terminal window. If it still isn’t found, the installer couldn’t change your shell settings: add /opt/local/bin and /opt/local/sbin to your PATH.
  • A port fails to build. Check that the Command Line Tools are installed, and Xcode if MacPorts asks for it, then update MacPorts: sudo port -v selfupdate Then try again.
  • Ports stopped working after a macOS upgrade. MacPorts must be reinstalled for each new major macOS: follow the Migration page linked on macports.org/install.php, which installs the new .pkg and rebuilds your ports.

Alternatives to MacPorts

Keep your Mac tidy

MacWashing, System Junk: Xcode junk, user caches, installers and logs found, 22.83 GB ready to be cleaned

Package managers and other developer tools keep downloads and build files that grow with every install. System Junk in MacWashing finds the caches apps and developer tools build up and shows how much space they take.

Free trial · macOS 14 or later

Questions and answers

Is MacPorts free?

Yes. MacPorts is free and open source, run by volunteers, and the ports it installs are free too.

Can I install MacPorts with Homebrew or from the App Store?

No. MacPorts comes only from macports.org, as an installer for your macOS version or as source code you build yourself.

MacPorts or Homebrew: which should I use?

Either works. Pick one. MacPorts keeps everything apart from the system in /opt/local and still supports very old macOS versions. Homebrew has more ready-made Mac apps: see how to install Homebrew.