Topic: Update ports

Sorry for noob question, but how can I update ports under FreeBSD?

Last edited by NooB (2011-11-04 03:44:04 am)

Share

Re: Update ports

First, you should get a fresh copy of ports tree. I can recommend portsnap. If you are running portsnap for the first time, extract the snapshot into /usr/ports:

# portsnap fetch
# portsnap extract

If you already have a populated /usr/ports and you are just updating, run the following command instead:

# portsnap fetch update

Now you can check which ports are outdated:

# pkg_version -v | grep need

You will see the following output:

ruby-1.8.7.352,1                    <   needs updating (port has 1.8.7.352_2,1)
sqlite3-3.7.7.1                     <   needs updating (port has 3.7.8)
wget-1.12_4                         <   needs updating (port has 1.13.4_1)

Next, install portupgrade utility to easily upgrade installed ports:

# cd /usr/ports/ports-mgmt/portupgrade
# make install clean

Scan the list of installed ports and fix all the inconsistencies it reports:

# pkgdb -F

It is a good idea to do this regularly, before every upgrade. If you want to upgrade all outdated ports, run:

# portupgrade -a

Use the -i flag if you want to be asked for confirmation of every individual upgrade:

# portupgrade -ai

If you want to upgrade only a certain application, not all available ports, use portupgrade pkgname. Include the -R flag if portupgrade should first upgrade all the ports required by the given application.

# portupgrade -R wget

After building and installing software from the ports, you should always remember to clean up the temporary work directories using the make clean command. You can sweep the whole Ports Collection with the following command:

# portsclean -C