FreeBSD Packaging
Packages
Binary packages are managed by pkg.
Ports
The ports source code tree offers software that is not supported with binary packages. It is a tree of Makefiles that offers flavors of applications. For example, a program that can be extended with Python or Lua addons (like vim) will have a flavor for each version of those interpretters, so that the final binary is compiled against the correct ABI.
Portsnap
portsnap(8) is a ports helper. First, run portsnap fetch && portsnap extract. This downloads the hierarchy locally to /usr/ports.
To update the hierarchy, run portsnap fetch && portsnap update.
Git
Alternatively, clone the git(1) repository of the project.
pkg install git git clone https://git.FreeBSD.org/ports.git /usr/ports # or, clone a quarterly release git clone https://git.FreeBSD.org/ports.git -b 2020Q3 /usr/ports
Subsequently, to update the repository, run:
# if using a quarterly branch, switch to the updated one git -C /usr/ports switch 2020Q4 git -C /usr/ports pull
Subversion
Historically the project used a svn(1) repository. The process was:
pkg install subversion svn checkout https://svn.FreeBSD.org/ports/head /usr/ports
Querying Software
Use pkg version -l "<" to list software that is out of date.
Use pkg query --all '%o %n-%v %R' | grep -e 'unknown-repository' to list installed ports.