A c t i o n s    o r    T a r g e t s    s u p p o r t e d    b y    MacPorts

Below is an exhaustive list of actions (also called targets) supported by port, as far as I could extract from available sources (Stand June 2016).

- Action target Target category Infos Examples
1 activate User

port activate <port-name(s)>
Activates the given ports.

2 archive Developer

port archive <port-name(s)>
Archives the given ports i.e. installs the port image but does not activate.

3 archivefetch Developer

port archivefetch <port-name(s)>
Fetches archive for the given ports.

4 build Developer

port build <port-name(s)>
Builds the given ports.

5 cat Developer

port cat <port-name(s)>
Concatenates and prints the contents of port-files to stdout.

6 cd

port cd <port-name>
Changes to the directory of the given port (only in interactive mode).

7 checksum Developer

port checksum <port-name(s)>
Compares the checksums for the downloaded files of the given ports.

8 clean User

port clean <port-name(s)>
Removes files associated with the given ports.

Following options are supported:

--archive removes temporary archives
--dist removes dist files
--logs removes log files
--work removes work directory (default)
--all removes everything from above

9 configure Developer

port configure <port-name(s)>
Configures the given ports.

10 contents User

port contents <port-name(s)>
Returns a list of files installed by the given port.

For example port contents perl5.22 returns 2240 entries: Files stored in /opt/local/bin/, /opt/local/lib/perl5/ (pm files), /opt/local/share/man/man1p, /opt/local/share/man/man3p.

11 deactivate User

port deactivate <port-name>
Deactivates the given port.

12 dependents User

port dependents <port-name(s)>
Echoes dependents ports - those ports that depend on the given port.

For example port dependents perl5.22 may return 55 entries (those ports that directly depend on perl5.22).

See also action rdependents.

13 deps User

port deps <port-name(s)>
Displays a dependency listing for <port-name(s)>: Those ports on which <port-name(s)> depend(s).

For example port deps perl5.22 may return following ports (on which perl5.22 depends):

Full Name: perl5.22 @5.22.2_0
Library Dependencies: gdbm

Action deps can be considered a short cut of following syntax:

  • port info depof:<port-name(s)> Action info returns more information than deps.
  • port echo depof:<port-name(s)> Action echo returns less information than deps.

See also action rdeps.

Note: Do not confuse dependents and deps they explore the same depends-on relationship but in the opposite direction.

14 destroot Developer

port destroot <port-name>
Installs port name to a temporary directory.

15 dir Developer

port dir <port-name>
Displays the path of the directory containing port name.

For example (on my current system) port dir perl5.22 returns /opt/local/var/macports/sources/rsync.macports.org/release/tarballs/ports/lang/perl5

See also action file.

16distcheck Developer

port distcheck <port-name(s)>
Checks whether the given ports (i.e. distfiles) have not changed and can be fetched from the master sites.

For example (on my current system) port distcheck perl5.22 returns:

Warning: couldn't fetch http://aarnet.au.distfiles.macports.org/pub/macports/mpdistfiles/perl5.22/perl-5.22.2.tar.bz2 for perl5.22 (HTTP response code said error)
Warning: couldn't fetch http://svn.macports.org/repository/macports/distfiles/perl5/perl-5.22.2.tar.bz2 for perl5.22 (HTTP response code said error)

17 distfiles Developer

port distfiles <port-name>
Returns a list of the distribution files associated with the given port.

For example (on my current system) port distfiles perl5.22 returns:

---> Distfiles for perl5.22
[perl-5.22.2.tar.bz2] /opt/local/var/macports/distfiles/perl5.22/perl-5.22.2.tar.bz2
rmd160: 203afca8995ca426db0af48b78eb606b5d24011a
sha256: f2322b9b04fe0cdbca9fe755360da04892cb6483d44959457cfebc0bcddc8058
http://www.cpan.org/src/5.0/perl-5.22.2.tar.bz2
https://distfiles.macports.org/perl5.22/perl-5.22.2.tar.bz2
http://aarnet.au.distfiles.macports.org/pub/macports/mpdistfiles/perl5.22/perl-5.22.2.tar.bz2
http://cjj.kr.distfiles.macports.org/perl5.22/perl-5.22.2.tar.bz2
http://fco.it.distfiles.macports.org/mirrors/macports-distfiles/perl5.22/perl-5.22.2.tar.bz2
http://her.gr.distfiles.macports.org/perl5.22/perl-5.22.2.tar.bz2
http://jnb.za.distfiles.macports.org/distfiles/perl5.22/perl-5.22.2.tar.bz2
http://jog.id.distfiles.macports.org/macports/distfiles/perl5.22/perl-5.22.2.tar.bz2
http://lil.fr.distfiles.macports.org/perl5.22/perl-5.22.2.tar.bz2
http://mse.uk.distfiles.macports.org/sites/distfiles.macports.org/perl5.22/perl-5.22.2.tar.bz2
http://nou.nc.distfiles.macports.org/pub/macports/distfiles.macports.org/perl5.22/perl-5.22.2.tar.bz2
http://nue.de.distfiles.macports.org/perl5.22/perl-5.22.2.tar.bz2
http://osl.no.distfiles.macports.org/perl5.22/perl-5.22.2.tar.bz2
http://sea.us.distfiles.macports.org/macports/distfiles/perl5.22/perl-5.22.2.tar.bz2
http://ykf.ca.distfiles.macports.org/MacPorts/mpdistfiles/perl5.22/perl-5.22.2.tar.bz2
http://svn.macports.org/repository/macports/distfiles/perl5/perl-5.22.2.tar.bz2

18 dmg Packaging

port dmg <port-name(s)>
Returns a disk image file dmg (distribution file format for OSX ) for each of the given ports.

See also action mdmg.

19 dpkg Packaging

port dpkg <port-name(s)>
Creates for each of the given ports a distribution file that can be handled by the Debian Package Manager dpkg.

20 echo User

port echo <pseudo-name>
Returns the list of ports <pseudo-name> expands to.

For example (on my current system) port echo installed returns 654 entries and port echo outdated returns no entry.

21 edit Developer

port edit <pseudo-name>
Edits the port-file associated with the given port.

For example port edit --editor vi perl5.22 edits port-file associated with perl5.22 using the vi editor.

22 exit

exit
Exits port in interactive mode.

See also action quit. (Is there a difference?)

23 extract Developer

port extract <port-name>
Extracts the distribution files of given port.

24 fetch Developer

port fetch <port-name>
Downloads (Fetches) the distribution files required to build given port (installation phase: fetch).

See also action mirror. (Is there a difference?)

25 file Developer

port file <port-name>
Returns the path to the (port) file(s) associated with given port (name).

For example (on my current system) port file perl5.22 returns /opt/local/var/macports/sources/rsync.macports.org/release/tarballs/ports/lang/perl5/Portfile

See also action dir.

26 gohome User

port gohome <port-name>
Opens the homepage of the given port.

For example (on my current system) port gohome perl5.22 opens following URL

27 help User

port help <action-name>
Displays information about action named <action-name>.

If no action is mentioned, displays lists of supported actions (listed in this table), pseudo port names, and selectors.

28 info User

port info <port-name(s)>
Returns information about the given ports.

Following options are available:

--category

--categories

--depends_fetch

--depends_extract

--depends_build

--depends_lib

--depends_run

--depends

An abbreviation for all depends_* fields.

--description

--epoch

--fullname

--heading

--homepage

--index

Do not read the port-file, instead rely solely on the index information.

--license

--line

prints one single line for each port, with fields separated by spaces. Handy for automatic processing of the output.

--long_description

--maintainer

--maintainers

--name

--platform

--platforms

--portdir

--pretty

Formats the output in a convenient, human-readable fashion (default)

--replaced_by

--revision

--subports

--variant

--variants

--version

Tab. List of --options for action info

For example (on my current system) port info vim returns following (on my system):

vim @7.4.1129 (editors)
Variants: athena, big, cscope, gtk1, gtk2, [+]huge, lua, motif, perl, python25, python26, python27, python31, python32, python33, python34, python35, ruby, ruby18, ruby19, ruby20, ruby21, ruby22, small, tcl, tiny, universal, x11, xim
Description: Vim is an advanced text editor that seeks to provide the power of the de-facto Unix editor 'Vi', with a more complete feature set.
Homepage: http://www.vim.org/
Build Dependencies: grep
Library Dependencies: ncurses, gettext, libiconv
Platforms: darwin, freebsd
License: Vim GPL-2+
Maintainers: raimue@macports.org

Remarks:

  • Almost all options defines a selector within the port-file - which can be viewed as a data base. Obviously not every selector is mentioned in every port-file.
  • The selector is sometimes available in singular or plural form e.g. maintainer and maintainers: There does not seem to be any difference concerning the result (probably - at least partially - due to the way information itself is stored in the port-file).
  • A few options control the output formatting.

29 install User

port install <port-name(s)>
Installs the given ports.

  • port checks for broken binaries, unless option --no-rev-upgrade is set - see also action rev-upgrade.
  • port marks the port as requested, unless option --unrequested is set.

30 installed User

port (echo) installed
Prints the list of all ports currently installed on the system.

For example (on my system)
port installed returns 654 entries.

Note: A similar action info installed yields much more information than echo.

31 lint Developer

port lint <port-name>
Checks if files associated with port name are lint free (i.e. OK).

32 list User

port list <port-name(s)>
Lists the available version for each given port. If no argument is given, it displays a list of the latest version of all available ports.

For example (on my system) port list perl5.22 returns

perl5.22 @5.22.2 lang/perl5

33 livecheck Developer

port livecheck <port-name(s)>
Checks if a new version of the software associated with each port-name is available.

For example port livecheck perl5.22 returns nothing (probably meaning that there is nothing to update).

34 load Developer

port load <port-name>
Interface to launchctl(1) for ports providing startup items (!?).

35 location User

port location <port-name(s)>
Returns the install location for each given port. If there are several versions of the software installed, port lists them - the active one is labeled (active). It finally throws an error, meaning that the exact name - including the version number - must be entered.

For example port location perl5.22 returns following (on my system):

The following versions of perl5.22 are currently installed:
perl5.22 @5.22.0_0
perl5.22 @5.22.1_1
perl5.22 @5.22.2_0 (active)
and an error... sent to stderr

port location perl5.22@5.22.2_0 returns:

Port perl5.22 5.22.2_0 is installed as an image in: /opt/local/var/macports/software/perl5.22/perl5.22-5.22.2_0.darwin_15.x86_64.tbz2

36 log User

port log <port-name(s)> Shows main log for the given ports. Following options are available:

--phase filters by phase Ifetch, checksum, extract, patch, configure, built, destroot)
--level filters messages above verbosity level (error, warn, msg, info, debug)

If no log file is available, an error Log file for port not found is thrown.

37 mdmg Packaging

port mdmg <port-name(s)>
Creates a disk image file dmg (distribution file format for OSX ) containing a multipackage installer script mpkg for each of the given ports and their dependencies.

See also action dmg.

38 mirror

port mirror <port-name(s)>
Fetches the distribution files for the given ports (installation phase: fetch).

See also action fetch. (Is there a difference?)

39mpkg Packaging

port mpkg <port-name(s)>
Creates a multi-package installer script file for OSX (mpkg file) for each of the given ports and their dependencies.

See also action mdmg.
See also action pkg.

40 notes

port notes <port-name(s)>
Displays informational notes for each of the given ports.

Many ports ( e.g. perl5.22 or vim ) have no notes. In this case the command displays message port has no notes.

41 outdated User

port (echo) outdated
Returns a list of outdated ports.

A similar action is port info outdated, which delivers more information, if ports happen to be outdated.
Otherwise ( if no port is outdated ),

  • The info variant throws error error: no port matches the given expression
  • The echo variant, only states that No installed port are outdated.

42 patch Developer

port patch <port-name(s)>
Applies patches to each given port.

43 pkg Packaging

port pkg <port-name(s)>
Creates a package installer script file for OSX ( pkg file ) for each of the given ports and their dependencies.

See also action dmg.
See also action mpkg.

44 platform User

port platform <port-name(s)>
Returns the current platform that port is running on.

For example port platform may return

darwin15i386

45 portpkg no help for portpkg
46 provides User

port provides <file-name(s)>
Determines which port owns a given file. The command can take either a relative or absolute path of file.

47 quit

quit
Exits port in interactive mode.

See also action exit. (Is there a difference?)

48 rdependents User

port rdependents <port-name(s)>
Recursive version of action dependents.

For example (on my current system) port rdependents perl5.22 returns 117 entries - as expected, more than those directly dependent.

49 rdeps User

port rdeps <port-name(s)>
displays a recursive dependency listing for <port-name(s)>: Those ports on which <port-name(s)> depend(s) directly or indirectly.

For example (on my current system) port rdeps perl5.22 returns following ports (on which perl5.22 depends directly or indirectly):

The following ports are dependencies of perl5.22 @5.22.2_0:
gdbm
 gettext
  expat
  libiconv
   gperf
  ncurses

As suggested by the output, there is only one port on which perl5.22 directly depends: gdbm (see also action deps). All other ports listed are indirect (higher level) dependencies .

50 rev-upgrade User

port rev-upgrade
Scans for broken binaries in the installed ports and rebuild them as needed. Can be run the general port option -y in order to perform a dry run i.e. to display steps without actually performing them. Target rev-upgrade is run automatically after each install or upgrade. (No need to run it manually).

Note: In order to ensure consistency, rev-upgrade always applies to all installed ports.

51 rpm Packaging

port rpm <port-name(s)>
creates a rpm (Red Hat Package Manager) for each given port. rpm typically contains pre-compiled software ready for installation, similar to a "tgz archive".

52 search User

port search <--option> <argument(s)>
Searches for ports that match argument(s).

Target search has two levels of control:

  1. Strings <argument(s)> can be literal or glob or regular expressions.
  2. Options <--option> can define to which type of information the argument strings relate.

Following options are available:

--case-sensitive
--category
--categories
--depends_fetch
--depends_extract
--depends_build
--depends_lib
--depends_run
--depends Means all depends_* selectors together.
--description
--epoch
--exact Matches the literal string exactly
--glob Treats the given search string as a glob expression.
--homepage
--line Each port found is displayed on a single line.
--long_description
--maintainer
--maintainers
--name
--platform
--platforms
--portdir
--regex Treats the given search string as a regular expression.
--revision
--variant
--variants
--version
Tab. List of --options for action search

53 select

port select <--option> <argument(s)>
Selects between multiple versions of a versioned port. Some ports maintain several versions of binaries at the same time : They form a select group e.g. python. In such case, users may actually have installed several versions of the same software e.g. python26, python27, python34. Action select has options for control about port behavior.

Following options are available:

--list Lists available versions of the group
--show Selects a given version for the group
--set Shows which version is currently selected for the group
--summary No arguments required. It displays the list of all available select groups. and choices as well as the currently selected ports.
Tab. List of --options available for action select

For example port select --summary may return following:

Name Selected Options
cython none cython27 none
gcc none mp-gcc5 none
llvm none mp-llvm-3.5 none
nosetests nosetests27 none
python none python26-apple python27 python27-apple python34 none
python2 none python27 none
python3 none python34 none

54 selfupdate User

port selfupdate <--option(s)>
Upgrades MacPorts itself and run the sync.

Following options are available:

--no-syncDoes not perform action sync (after updating itself).

55 setrequested

port requested <port-name(s)>
Marks each given port as requested.

56 space

port space <--options> port-name(s)
Shows the disk space used by port-names.

Following options are available:

--units Available units are B, kB, KiB, MB, MiB, GB, GiB.
--total Displays the grand total only.

57 srpm Packaging

port srpm <port-name(s)>
Creates a srpm (Source Red Hat Package Manager) for each given port. In comparison to rpm, srpm typically contains the source code of the software to distribute, similar to a "xar portpkg".

58 sync User

port sync <port-name(s)>
Synchronizes the set of portfiles, pulling in the latest revision available of the Porfiles from the MacPorts rsync server. As a result the ports tree is updated.

59 test Developer

port test <port-name(s)>
Runs tests on each of the given ports.

60 unarchive Developer

port unarchive <port-name(s)>
Unpacks the port from a pre-bilt binary archive. When archive mode is enabled, this command is called automatically, prior to fetch, to check for an existing binary archive to unpack. If found, it is unpacked and all stages up to install are then skipped.

61 uninstall User

port uninstall <port-name(s)>
Deactivates and uninstalls each given portname.

62 unload Developer

port unload <port-name>
Interface to launchctl(1) for ports providing startup items (!?).

63 unsetrequested Developer

port unsetrequested <port-name(s)>
Marks each given port as unrequested.

64 upgrade User

port upgrade <port-name(s)>
Upgrades each given port to the latest version.

Respects global option -n (don't follow dependencies in upgrade), -R (also upgade dependents) and -u(uninstall non-active ports when upgrading and uninstalling). Note that in selecting variants to use in the upgraded build of the port, the order of precedence is variants specified on the command line, the variants active in the latest installed version of the port, then the variants.conf file

Following options are supported:

--force Ignore circumstances that would normally cause ports to abort.
--enforce-variants If the installed variants do not match those requested, upgrade even if the port is not outdated.
--no-replace Do not replace one port with another according to the replaced_by field.

65 url User

port url <port-name(s)>
Returns the URL of each given port.

66 usage User

port usage
Returns basic usage of the port command (better use port help or man 1 port).

67 variants User

port variants <port-name(s)>
Prints a list of variants associated with the given ports, with a description, if available.

For example port variants perl5 may return following

perl5_22: Use MacPorts perl5.22 conflicts with perl5_24
perl5_24: Use MacPorts perl5.24 conflicts with perl5_22

68 version User

port version
Returns the current version of MacPorts.

69 work

No help for topic work

Tab. Action or Targets supported by port

Remarks: