FreeBSD Ports

Download ports tree
portsnap fetch
portsnap extract
Update ports tree
portsnap fetch
portsnap update
Upgrading packages installed with ports

List outdated ports:

pkg_version -v
pkg_version -vIL=

Install portmaster. Portmaster is designed to use the base system of FreeBSD.

cd /usr/ports/ports-mgmt/portmaster
make install

List all installed software and search for updates:

portmaster -L

Upgrade all ports at once:

portmaster -a

Use portmaster to install a package, and upgrade all dependencies if necessary:

portmaster shells/bash
Find the location of a port
whereis name
ls /usr/ports/*/name
Download port distfiles
make fetch
Uninstall a port
make deinstall
Reinstall a port after it's been built
make reinstall
Create a list of all ports
find /usr/ports/ -type d -mindepth 2 -maxdepth 2 | grep -v CVS | grep -v Tools | sed -e 's/\/usr\/ports\///g' > ~/all-ports
List installed packages
Update search ports index
cd /usr/ports && make index
Search ports
cd /usr/ports
make search name=<name>
make search key=<key>
Display out of date packages
pkg_version -v
Package configuration

Modify configuration:

make config

Output configuration settings:

make showconfig

Reset configuration:

make rmconfig
Build with default options
make -DBATCH
Build with specific options
Install Kernel Sources
cd /usr/ports/devel/subversion && make install
svn checkout /usr/src

Tell cron to check for release updates nightly. The system will send an email if there are any to apply.

echo "# Security updates" >> /etc/crontab
echo "@daily root freebsd-update cron" >> /etc/crontab
Run make clean on all dependencies
make clean-depends