FreeBSD keep ports collection up to date in two easy steps

The FreeBSD ports collection offers a simple way for users and administrators to install applications. The ports made FreeBSD quite popular. Keeping ports up to date is an essential task.

FreeBSD Install cvsup

If you never upgraded freebsd ports collection then first step is required; otherwise skip this step and goto step # 2

# pkg_add -r cvsup-without-gui
# mkdir /usr/ports

CVSup is a software package for distributing and updating collections of files (ports) across a network.

Update ports collection/tree

# cvsup -L 2 -h

Above step will take some to fetch files and it will update your ports collection.

Note if you got an error as follows:

Rejected by server: Access limit exceeded; try again later
Will retry at 01:36:41

Then replace with, etc. You are done. Install packages from updated tree, before that consider installing security auditing port to avoid vulnerabilities warning. Now you can install application via ports.

Running the cvsup command later agian will download and apply all the recent changes to your Ports Collection, except actually rebuilding the ports for your own system. Next time you will see howto use the portupgrade utility to upgrade installed ports.

portsnap command

You can use portsnap command. It is an alternative system for distributing the Ports Collection. It was first included in FreeBSD 6.0. Install portsnap as follows:

# mkdir /usr/ports
# pkg_add -r portsnap
# portsnap fetch
# portsnap extract
# portsnap update

See FreeBSD handbook topic Using Portsnap more information.

🐧 Get the latest tutorials on Linux, Open Source & DevOps via RSS feed or Weekly email newsletter.

🐧 6 comments so far... add one
CategoryList of Unix and Linux commands
Disk space analyzersncdu pydf
File Managementcat
FirewallAlpine Awall CentOS 8 OpenSUSE RHEL 8 Ubuntu 16.04 Ubuntu 18.04 Ubuntu 20.04
Network UtilitiesNetHogs dig host ip nmap
OpenVPNCentOS 7 CentOS 8 Debian 10 Debian 8/9 Ubuntu 18.04 Ubuntu 20.04
Package Managerapk apt
Processes Managementbg chroot cron disown fg jobs killall kill pidof pstree pwdx time
Searchinggrep whereis which
User Informationgroups id lastcomm last lid/libuser-lid logname members users whoami who w
WireGuard VPNAlpine CentOS 8 Debian 10 Firewall Ubuntu 20.04
6 comments… add one
  • Anonymous Jan 8, 2006 @ 6:03

    I’m new to Freebsd but I recently read about and have been using “portsnap” instead of cvsup to keep my ports updated. Works really nicely. Just two commands “portsnap fetch” and “portsnap update”.

  • 🐧 nixcraft Jan 8, 2006 @ 15:59

    Yup portsnap is an alternative and very good system for distributing the Ports Collection. It was first included in FreeBSD 6.0.

  • Anonymous Jan 8, 2006 @ 16:32

    You can use sysinstall too:

  • James Aug 15, 2007 @ 15:30

    You don’t need to install cvsup; FreeBSD comes with csup preinstalled, which is cvsup re-written in C to run faster. csup has no GUI.

  • jonny Mar 7, 2010 @ 0:19

    portsnap keeps the ports tree in sync, but that’s half the story…
    how can i keep my installed packages in sync without rebuilding all ports?

    • G.Bonev Oct 14, 2010 @ 11:18

      How did you install them on 1st place ?
      I believe with pkg_add -r perhaps and/or by compiling them directly from the ports.
      If that’s the case those binaries that you are installing with pkg_add are pre-build from standart port tree and standart(default) gcc options.
      If the port you want to update is too fresh you will probably not be able to find it on pre-build binaries.. I think. So you will need to recompile from the freshened ports tree you already have on the local machine.
      I am sure somewhere on the inet you can find scripts that will do that for you automatically. Or you can make yourself one.
      About the core of the OS – you can apply security and version patches directly as precompiled binary as they should have been maintained more often.

Leave a Reply

Your email address will not be published.

Use HTML <pre>...</pre> for code samples. Still have questions? Post it on our forum