port [-vdqysbckpotf] [-D portdir] dmg
     [[portname | pseudo-portname | port-expressions | port-url]]
port [-vdqysbckpotf] [-D portdir] mdmg
     [[portname | pseudo-portname | port-expressions | port-url]]
port [-vdqysbckpotf] [-D portdir] pkg
     [[portname | pseudo-portname | port-expressions | port-url]]
port [-vdqysbckpotf] [-D portdir] mpkg
     [[portname | pseudo-portname | port-expressions | port-url]]


These commands create macOS-native binary archives of a given port. Depending on the command, one of a .dmg disk image file, a .pkg, or .mpkg installer package is created.

port pkg creates a macOS installer package that installs all files that belong to a given port. port dmg wraps this installer package in a disk image. In most cases you probably want to package a port and all its library and runtime dependencies in a single package suitable for binary distribution. port pkg and port dmg don’t do that, so those are only useful if you are going to take care of the dependencies separately. port mpkg creates an .mpkg installer image that contains installer packages for each of the dependencies and is suitable for standalone redistribution. port mdmg wraps this .mpkg package in a disk image.

On Mac OS X 10.6 and later, the generated installer packages are in “flat” format, such that wrapping them in a disk image is no longer necessary for online redistribution. Prior to Mac OS X 10.6, generated installer packages could not be used for online distribution without a wrapping disk image.

All packages are placed in a port’s work directory, which can be located using port-work(1).


If you want to create installer packages using MacPorts for redistribution, make sure you do not use a standard installation of MacPorts in /opt/local. If you do that, your installer package will conflict on systems that do have MacPorts installed.

Instead, follow Section 2.2.4 of the MacPorts Guide and choose a prefix specific to the software you are trying to package, e.g., /opt/logrotate for logrotate. Then use this custom MacPorts installation to build your package.


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



(C) 2014 The MacPorts Project
Clemens Lang <>