port [-qvdp] [-D portdir] mirror
     [[portname | pseudo-portname | port-expressions | port-url]]


port mirror creates or updates a local mirror of source archives (called distfiles in MacPorts lingo) for the ports given on the command line. It will download any file that can be fetched using the standard libcurl(3) download method and ignore ports that fetch from version control systems such as Subversion or Git.

Downloaded files will be checked for consistency and deleted if the checksums don’t match those specified in the Portfile. Additionally, successfully downloaded files are stored in a custom database in $portdbpath/distfiles_mirror.db, where $portdbpath can be configured in macports.conf(5). This database can be deleted and re-created from scratch using the --new option.

Ports that have NoMirror in their license field will not be mirrored.



Delete the existing database of mirrored files and re-create it from scratch.


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


Don’t abort downloading on the first error. This can be useful when attempting to create or update a full mirror, e.g. when using port mirror all.


If your use case for port mirror is downloading the files you need to install a set of ports later without a network connection, do not use port mirror: It will not work for ports that distribute their source code using a version control system such as Subversion or Git. Instead, use port fetch:

$> sudo port -p fetch rdepof:$newport and not installed
$> sudo port -p fetch $newport

These can also be conveniently wrapped in a single command using a port expression (see port(1) for details):

$> sudo port -p fetch $newport rdepof:$newport and not installed

If your intention is creating a new complete mirror of all MacPorts distfiles, it is probably easier to sync them via rsync from our main mirror. See Mirrors for details.

If you want to create a partial mirror of MacPorts distfiles or are running the main mirror for MacPorts, you should use port mirror:

$> sudo port -p mirror all
$> sudo port -p mirror maintainer:^cal or category:haskell



(C) 2014 The MacPorts Project
Clemens Lang <>