Using MacPorts

MacPorts is a package manager for macOS computers.


How do I use MacPorts?


LSA TS - Randall supported Macs


MacPorts commands

Installing or modifying installed ports requires an administrator account.

Basic syntax for installing packages with port

The basic syntax is: sudo port options install packages.

port also allows for multiple package installation. For example, the following command installs the vim, ntop, and apache packages: sudo port install vim ntop apache

To display a complete list of installed applications: port installed.

Searching for packages

The sudo port search package command searches for packages that match package. Additionally, regular expressions/wildcards can be used with the search function, as in sudo port search package*.

For example, the following command shows packages that start with 'vim': sudo port search 'vim*'

Additional commands

In addition to the commands below, you can find more detailed and extensive command information in the MacPorts Documentation.

  • port clean package — Clean out any leftover files from building a port. Useful if a port install fails and you need to clear out the temporary files before trying again.
  • port upgrade package — Update package along with package dependencies.
  • port outdated — Generates a list of ports that have new versions available. 
  • port upgrade outdated — Updates all ports that have an upgrade available. This takes a considerable amount of time to run.
  • port installed inactive — Gets a list of inactive ports you likely no longer need.
  • port uninstall inactive — Removes all inactive ports at once.
  • port uninstall inactive and not package— Uninstall all inactive ports but the specified single one.
  • port -s package — Attempt to build from source rather than just downloading and installing binary.
  • port info package — List specific package information.
  • port uninstall package — Remove specified package.
  • port provides package — Used for locating package file ownership.
  • port sync — Sync the entire package system, but do not update.  It is better to use selfupdate unless there is a special reason not to do so.
  • port -d selfupdate — Updates the local ports tree, checks for new releases for MacPorts and upgrades it when necessary.  The -d is a debug flag to give verbose information.
  • port space --units MB --total package — Show the disk space used by the specified installed package

Migrating MacPorts after an OS upgrade

Additional notes


Article ID: 1686
Wed 5/27/20 9:58 AM
Fri 1/7/22 5:16 PM