port [-D portdir] space [--units unit] [total]
    [[portname | pseudo-portname | port-expressions | port-url]]


port space lists the amount of disk space the port(s) given on the command line occupy on disk. Note that the space reported is for the files installed by a port, but not the image of the port’s files MacPorts keeps internally. See the PORT IMAGES section for more information on how images work. Consequently, port space will only work on active ports.

By default, port space will print a line with the size in an appropriate unit followed by the name of a port for each port given on the command line (or expanded from a pseudo-port expression given; see port(1) for more info on pseudo-port expressions). The last line of output will contain a total.

If you are only interested in the total of all ports (e.g. if you want to get the total amount of space used by your installed ports) use the --total flag. If you want to sort the output by file size, you can pipe the results of port space to sort -n. Since port space defaults to using a suitable unit, you should specify a unit to allow for meaningful numeric sorting, e.g. port space --units KiB to get all output in KiB.



Only print the total amount of space used by all given ports.

--units unit

Choose the unit in which the size is given. You should specify this if you intend to sort the output. Valid values for unit are


List sizes in bytes.

K, Ki, KiB

List sizes in KiB, i.e., 1024 bytes.

Mi, MiB

List sizes in MiB, i.e., 1024 * 1024 bytes.

Gi, GiB

List sizes in GiB, i.e., 1024 * 1024 * 1024 bytes.

k, kB

List sizes in kB, i.e., 1000 bytes.


List sizes in MB, i.e., 1000 * 1000 bytes.


List sizes in GB, i.e., 1000 * 1000 * 1000 bytes.


Please see the section GLOBAL OPTIONS in the port(1) man page for a description of global port options.


MacPorts has the ability to install multiple versions or different variant selections of the same port. The files will be stored in an intermediate location as archives, which allows to switch between the versions. Only one version can be active at a time. On activation, files will be copied to their intended place in prefix.

More information on this topic can be found in the The MacPorts Guide.

To check the current status of a specific port, use port-installed(1).


To find the 10 largest ports in your MacPorts installation, you can use the following command:

$> port space --units MiB active | sort -rn | head -n10



(C) 2015 The MacPorts Project
Clemens Lang <>