Upgrading Ports/Packages

General Information

So, you install stuff from ports and then updates are released. How do you upgrade your software without having to uninstall and reinstall? This guide will show you how to use portupgrade.


  1. Local root access on the box or be able to su to root.
  2. A SSH client such as puTTy or SecureCRT (if you are setting it up remotely).
  3. Portsnap or cvsup-without-gui
  4. Ports! If you don’t have ports installed, you can install it with /stand/sysinstall


In order for us to use the upgrade utility, we need to install it first. So, logon to the machine as root or su to root.

# cd /usr/ports/sysutils/portupgrade
# make install clean


Now we need to know what packages are out of date and update them. You can either use the portsnap method or the legacy cvsup method. I already use portsnap.

# portsnap fetch update

Now that the ports tree is updated, let’s see which of our ports are outdated.

# pkg_version
apache                              =
cups-base                           <
cvsup-without-gui                   =
daemontools                         =
lynx                                =
m4                                  =
mod_php4                            <
nano                                =
p5-DBI                              <
p5-Data-ShowTable                   =
p5-Mysql-modules                    =
p5-Net-Daemon                       =
p5-PlRPC                            =
perl                                <
portupgrade                         =
samba                               =
ucspi-tcp                           =
wget                                =

You can also limit the display to only outdated packages with:

# pkg_version -L =
cups-base                           <
mod_php4                            <
p5-DBI                              <
perl                                <

As you can see, there are a few packages that need to be updated. The format of portupgrade is as follows:

# portupgrade -o /path/to/port port_name

We're going to upgrade cups-base. So, we will run

# portupgrade -o /usr/ports/print/cups-base cups-base

If you don't know where the port is located at, run:

# cd /usr/ports
# whereis port_name

Once it does its thing, you're all updated. You can run that for each port, or if you are daring, you can upgrade every port with:

# portupgrade -ra

Speak Your Mind