Maintaining Ports with Portmaster

Synopsis:

The portmaster utility is a tool for updating your ports. It does not use an external database to track what you have installed. Rather it uses the existing ports infrastructure, including what is located in /var/db/pkg. The focus of this tool is to keep the dependency tracking information for your ports up to date. This allows you to safely update a specific port without having to update all of the ports "above" it. In the rare case where you do need to recompile ports which depend on a port you are updating, the -r option exists to accomplish this.

I. Installation

Portmaster is included in the FreeBSD Ports. If you need to install Ports, go Here

#
# cd /usr/ports/ports-mgmt/portmaster && make install clean
#

Use the default compile options:
Now the actual installation will proceed.
The compiler and installation process takes only a few minutes to install the program on the Celeron 1.6G system.


II. Usage

1. List all installed ports:
#
# portmaster -L
#
2. Update ALL ports on the system
(Do a 'portsnap fetch update' first.)
#
# portmaster -af
#
3. Update a single port program, example: curl
#
# portmaster -d curl
#
4. Remove a program and all dependencies, example: git
#
# portmaster -e git
# portmaster -y -d -s git
#

5. Update all ports that need updating, and delete stale distfiles after the update is done.

#
# portmaster -aD
# portmaster --clean-distfiles -y
#

6. Portmaster options
--force-config
--no-confirm
-m arguments for make
--update-if-newer
--version
-C //prevents make clean before build
-G //prevents make config
-K //prevents make clean after build
-B //prevents creating backup package
-b //create and keep backup package of installed port
-g //create package of new port
-n //run all steps, don't make or install anything
-v //verbose
-f //always rebuild ports, overrides -i
-i //interactive, ask to rebuild ports
-D //no distfiles cleaning
-d //always clean distfiles
-a //check all ports, update if necessary
-o dir/new-port dir/installed-port
-l //list all installed ports by catagory
-L //list all installed ports by category, search for updates
-n //answer no to all user prompts
-y //answer yes to all user prompts
-s //cleans out stale ports that used to be depended on

7. Rebuild all ports on the system
#
# portmaster -afD
#
7. If that process is interrupted for any reason you can use portmaster -a -f -D -R to avoid rebuilding ports already rebuilt on previous runs.
#
# portmaster -afDR
#
8. Update options for a port. This could occur when more options are needed or if an option needs to be removed. Move into the port's folder, then:
#
# make config
#
Change the options and recompile
#
# make deinstall install
#
To return the options to the original defaults:
#
# make rmconfig
#