FreeBSD Update All Installed Ports / Applications

by on August 26, 2009 · 7 comments· LAST UPDATED June 11, 2013

in , ,

It is recommended that to keep FreeBSD systems up to date with the latest application security patches installed via ports collection. The yum command line tool is used to install and update software packages under CentOS / RHEL / Fedora Linux. However, I've tons of apps installed under FreeBSD. How do I upgrade all packages under FreeBSD?

FreeBSD comes with various tools to to install and update software packages. The portmaster command line tool is used to install and update software packages. There are four steps here. Most of the actions listed in this FAQ are written with the assumption that they will be executed by the root user running the csh or bash shell.

Step # 1: Update FreeBSD Ports Tree

Type the following command. Only run this command to initialize your portsnap-maintained ports tree for the first time:
# portsnap fetch extract
Install portmaster to manage your ports without external databases or languages:
# cd /usr/ports/ports-mgmt/portmaster
# make install clean

Step # 2: List All Outdated Packages FreeBSD Ports Tree

Type the following command:
# pkg_version -l '<'
Sample Output:

apache                              <
libiconv                            <
libxml2                             <
mod_security                        <
mysql-client                        <
p5-Storable                         <
portmaster                          <
postfix                             <
spawn-fcgi                          <

Step # 3: Read /usr/ports/UPDATING File

Open /usr/ports/UPDATING file using a text editor and read information regarding your applications. This file describes various issues and additional steps users may encounter and need to perform when updating a port, including such things as file format changes, changes in locations of configuration files, or other such incompatibilities with previous versions.
# vi /usr/ports/UPDATING

Step # 4: Upgrade All Packages / Ports / Apps

Type the following command:
# portmaster -Da
Sample Outputs:

===>>> Starting check of installed ports for available updates
===>>> Checking ports for recursive 'make config'
	===>>> The devel/libltdl15 port moved to devel/libltdl22
	===>>> Reason: Update to libltdl22
===>>> Launching child to update libltdl-1.5.26
	===>>> The devel/libltdl15 port moved to devel/libltdl22
	===>>> Reason: Update to libltdl22
......
......output terminated...
....

How Do I Repeat These Steps Again?

Simply use the following command sequence (note: portsnap update option):
# portsnap fetch update
# pkg_version -l '<'
# vi /usr/ports/UPDATING
# portmaster -Da

TwitterFacebookGoogle+PDF versionFound an error/typo on this page? Help us!

{ 7 comments… read them below or add one }

1 Woolfer August 27, 2009 at 7:58 am

1. portsnap fetch && portsnap update
2. portupgrade -rR *

Reply

2 Shoaibi August 27, 2009 at 10:31 am

i use:
portsnap fetch && portsnap update && portaudit -F && portupgrade -aR

all in one go :P

Good post btw, thanks.

Reply

3 Valqk August 27, 2009 at 12:38 pm

Wonderful app portmaster is. :-)
I use it with with -ag switches bcause I have a pkg server :)
portupgrade sux (according to me :)

Reply

4 nixCraft August 27, 2009 at 1:14 pm

Can be:

portsnap fetch && portsnap update

Run as :

portsnap fetch update

portupgrade needs ruby and db. portmaster directly work, it is a small and very fast tool. pkg_version is part of base system. Reading /usr/ports/UPDATING is mandatory.

HTH

Reply

5 SIFE September 20, 2009 at 12:17 am

Salamo Alikom
how can i update single port ?

Reply

6 m May 16, 2012 at 6:11 am

it fails for me,it say that “no mirrors remaining,giving up” .
what should I do?

Reply

7 Nick August 18, 2014 at 11:44 am

Doesn’t work on a Raspberry Pi!

# uname -a
FreeBSD bsdpi 11.0-CURRENT FreeBSD 11.0-CURRENT #0 r268111: Wed Jul  2 09:28:29 UTC 2014     root@grind.freebsd.org:/usr/obj/arm.armv6/usr/src/sys/RPI-B  arm

And:

root@bsdpi:/usr/ports/ports-mgmt/portmaster # sh
# make install clean
===> Building/installing dialog4ports as it is required for the config dialog
===>  Cleaning for dialog4ports-0.1.5_2
===>  License BSD2CLAUSE accepted by the user
===>   dialog4ports-0.1.5_2 depends on file: /usr/local/sbin/pkg - found
===> Fetching all distfiles required by dialog4ports-0.1.5_2 for building
===>  Extracting for dialog4ports-0.1.5_2
=> SHA256 Checksum OK for dialog4ports-0.1.5.tar.gz.
===>  Patching for dialog4ports-0.1.5_2
===>  Configuring for dialog4ports-0.1.5_2
===>  Building for dialog4ports-0.1.5_2
Warning: Object directory not changed from original /usr/ports/ports-mgmt/dialog4ports/work/dialog4ports-0.1.5
cc -O -pipe    -std=gnu99 -Wsystem-headers -Werror -Wall -Wno-format-y2k -W -Wno-unused-parameter -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith -Wreturn-type -Wcast-qual -Wwrite-strings -Wswitch -Wshadow -Wunused-parameter -Wcast-align -Wchar-subscripts -Winline -Wnested-externs -Wredundant-decls -Wold-style-definition -Wno-pointer-sign -Wmissing-variable-declarations -Wno-empty-body -Wno-string-plus-int -Wno-unused-const-variable -Qunused-arguments -c dialog4ports.c
cc -O -pipe    -std=gnu99 -Wsystem-headers -Werror -Wall -Wno-format-y2k -W -Wno-unused-parameter -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith -Wreturn-type -Wcast-qual -Wwrite-strings -Wswitch -Wshadow -Wunused-parameter -Wcast-align -Wchar-subscripts -Winline -Wnested-externs -Wredundant-decls -Wold-style-definition -Wno-pointer-sign -Wmissing-variable-declarations -Wno-empty-body -Wno-string-plus-int -Wno-unused-const-variable -Qunused-arguments -c mixedlist.c
gzip -cn dialog4ports.1 > dialog4ports.1.gz
cc -O -pipe    -std=gnu99 -Wsystem-headers -Werror -Wall -Wno-format-y2k -W -Wno-unused-parameter -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith -Wreturn-type -Wcast-qual -Wwrite-strings -Wswitch -Wshadow -Wunused-parameter -Wcast-align -Wchar-subscripts -Winline -Wnested-externs -Wredundant-decls -Wold-style-definition -Wno-pointer-sign -Wmissing-variable-declarations -Wno-empty-body -Wno-string-plus-int -Wno-unused-const-variable -Qunused-arguments  -o dialog4ports dialog4ports.o mixedlist.o -lncursesw -lm -ldialog
===>  Staging for dialog4ports-0.1.5_2
===>   Generating temporary packing list
install -s -o root -g wheel -m 555   dialog4ports /usr/ports/ports-mgmt/dialog4ports/work/stage/usr/local/bin/dialog4ports
install -o root -g wheel -m 444 dialog4ports.1.gz  /usr/ports/ports-mgmt/dialog4ports/work/stage/usr/local/man/man1
====> Compressing man pages (compress-man)
===>  Installing for dialog4ports-0.1.5_2
===>  Checking if dialog4ports already installed
Bad system call (core dumped)
*** Error code 140
Stop.
make[3]: stopped in /usr/ports/ports-mgmt/dialog4ports
*** Error code 1
Stop.
make[2]: stopped in /usr/ports/ports-mgmt/dialog4ports
===> Options unchanged
===>  Installing for portmaster-3.17.6
===>  Checking if portmaster already installed
Bad system call (core dumped)
*** Error code 140
Stop.
make[1]: stopped in /usr/ports/ports-mgmt/portmaster
*** Error code 1
Stop.
make: stopped in /usr/ports/ports-mgmt/portmaster
#

Reply

Leave a Comment

Tagged as: , , , , , ,

Previous Faq:

Next Faq: