Using MacPorts

MacPorts is a package manager for macOS computers.

Question

How do I use MacPorts?

Environment

LSA TS - Randall supported Macs

Answer

MacPorts commands

 Note
Installing or modifying installed ports requires an administrator account. If you do not have an admin account on the computer, please send an email to lsait@umich.edu to get the port installed.

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 -R package — Update package along with package dependencies.
  • port -s package — Attempt to build from source rather than just downloading and installing binary.
  • port info package — List specific package information.
  • port -u uninstall package — Remove specified package.
  • port provides package — Used for locating package file ownership.
  • port -d sync — Sync the entire package system.
  • port space --units MB --total package — Show the disk space used by the specified installed package

Migrating MacPorts after an OS upgrade

Additional notes

Details

Article ID: 1686
Created
Wed 5/27/20 9:58 AM
Modified
Tue 6/23/20 11:31 AM