PORTS(8) System Manager's Manual PORTS(8)

ports — sync, list, compare and clean port collections

ports -u [name ...]

ports -l [collection ...]

ports -d [collection ...]

ports -x[dfsw] [collection ...]

ports -h | -v

ports keeps the port collections up to date and reports on them. Collections are configured by files in /etc/ports/ ending in .rsync or .git; see CONFIGURATION. Files with any other name, such as the shipped ports.rsync.inactive, are ignored.

The options are as follows:

Compare the port tree with the package database. For every installed package whose port has a different version-release, print the collection, port, installed version and port version.
, --help
Print a usage summary.
List every port, as collection/port.
[name ...]
Sync the collections from their remotes. A name may be a configuration file without its extension, which syncs all of its collections, or a collection name. Without a name, everything is synced. Requires root.
, --version
Print the version.
[dfsw]
Clean the port directories: remove package files other than the one the port's recipe would build. Further letters remove more:
Source archives that the recipe does not list.
.footprint files.
.signature files.
work directories.

Requires root.

-l, -d and -x work on every configured collection: each collection of an rsync configuration, under its key, and each git configuration, under its file name. If no configuration is active they use /ports/core, /usr/ports/libs, /usr/ports/devel, /usr/ports/python, /usr/ports/perl and /usr/ports/opt instead. Every directory in /usr/local/ports/ is a collection as well. Naming one or more collections restricts them to those.

A directory is a port if it holds a MAKEPKG or a MAKEPKG.lock. The recipe of a port is MAKEPKG.lock if there is one, else MAKEPKG, as for mkpkg(8).

Only the recipes and the files that belong with them are synced. Package archives, source archives, work/ directories and *.lock files are never transferred and never deleted, so locked ports keep their lock; see mkpkg(8). File owners are not copied, and modes become 755 for directories and 644 for files.

With rsync, a port directory that exists upstream is made identical to it. Nothing else in the destination is deleted by the transfer, so a collection may live in a directory it shares with other files, such as /usr/src. A port that upstream no longer has is removed afterwards, but only if its directory holds a MAKEPKG and no MAKEPKG.lock; a locked port is kept and reported. Other directories and files are never touched.

With git, the destination is cloned if it is not a git checkout yet, and otherwise updated with git pull --ff-only.

An rsync configuration, /etc/ports/name.rsync, has key=value lines:

The rsync server.
The rsync module.
Optional. Used as user name and, through RSYNC_PASSWORD, as password.
collection=directory
Any other key is a collection: the remote directory module/collection/ is synced into directory.

A git configuration, /etc/ports/name.git, has url, branch, which defaults to main, and destination.

Empty lines and lines starting with ‘#’ are ignored.

/etc/ports/*.rsync, /etc/ports/*.git
Collection configuration.
/var/lib/pkg/db
Package database, read by -d.

The ports utility exits 0 on success, and >0 if an error occurs. -u fails if any collection failed to sync.

An rsync configuration with two collections:

host=rsync.rawnix.org
module=ports
token=YOUR_TOKEN

core=/ports/core
linux=/usr/src

Sync only the core collection:

# ports -u core

rsync(1), MAKEPKG(5), bulk(8), mkpkg(8)

September 27, 2026 mkpkg 1.6.0