MacPorts Cheatsheet
https://guide.macports.org/#using.port
port help
show brief info about an action
port selfupdate
update the local ports tree with global MacPorts ports repository
also update MacPorts itself
port sync
only updates ports tree, generally not recommended
port diagnose
check for common issues in environment
port reclaim
reclaim disk space by uninstalling things no longer needed
port list
lists the currently available version of the specific ports
if not ports are specificed, lists all available ports
always lists the most recent version available in MacPorts which may differ from installed
where would use list
, installed
or echo
is better choice
when searching, search
is better choice when trying to list ports
port search
find ports by partial match of name or description
--name
to limit search to name (by default searches name and description)
--glob
is default, --regex
is available
--line
enable compact output
port info
gets information about a port
port deps
lists the dependencies of port
"Dependencies are the packages are required by a port at runtime (library and runtime dependencies) or required to install it (build, fetch, and extract dependencies)."
port variants
check what variations of a port are available before installing it
port install
install a port
"The installation of a single port consists of multiple phases. These phases are fetch, extract, patch, configure, build, destroot, archive, and finally install. You may break up a port's installation into smaller steps for troubleshooting by using the name of one of these phases as action rather than install."
port notes
display any notes that a port's author included
port clean
deletes intermediate files created by MacPorts while installing a port
port uninstall
remove an installed port
will refuse to uninstall ports needed by other ports
--follow-dependents
to recursively uninstall all ports that depend on the given port before uninstalling the port itself
will not uninstall ports that have been automatically installed as dependencies of the uninstalled port and are otherwise unused unless --follow-dependencies
is passed
manually installed ports ("requested") or have other dependents will not be removed
can manually uninstall unneeded ports later during using leaves
pseudo-port
port contents
list of all files installed by a given port
port installed
display the installed versions and variants of the specified ports
if no ports are specified, all installed ports are displayed
also displays whether port is "active" (are files on disk or stashed away?)
-v
for platform and CPU info
port outdated
checks installed ports against current ports tree to see if they have been updated since installation
port upgrade
upgrade installed ports and their deps to latest version
does not uninstall the old version, deactivates instead
port dependents
reports what ports dependent upon a given installed port
port livecheck
check if newer version available on developer's download size
port lint
check if the Portfile conforms to standard
port load
activate the port's launchd services
port unload
deactivate the port's launchd services
pseudo-portnames
https://man.macports.org/port.1.html
- all: all the ports in each ports tree listed in sources.conf
- current: the port in the current working directory
- active: set of installed and active ports
- inactive: set of installed but inactive ports
- installed: set of all installed ports
- uninstalled: ports in the ports tree(s) that are not installed
- outdated: installed ports that are out of date with respect to their current version/revision in the ports tree(s)
- obsolete: set of ports that are installed but no longer exist in any port tree
- requested: installed ports that were explicitly asked for
- unrequested: installed ports that were installed only to satisfy dependencies
- leaves: installed ports that are unrequested and have no dependents
- rleaves: installed ports that are unrequested and that no requested ports depend on
dependency relations
Do not confuse 'dependents' and 'dependencies' (or, shortened, 'deps'). Refer to the following example to understand the difference:
portA --> portB
portA depends on portB, i.e., portA needs portB to run. Because of that, portB is a 'dependency' (or 'dep') of portA. After installing portA, portB has been automatically installed. At this point, portA has become a 'dependent' of portB. You can only uninstall portB once all of its dependents (i.e., including portA) have been uninstalled.
Refs: https://github.com/macports/macports-base/blob/master/doc/dependents-vs-dependencies.txt
Created: 2024-01-26
Last Updated: 2024-01-26