Posts tagged ‘portupgrade’

How to update all your installed ports on FreeBSD using portupgrade?

Ok, this week there is a simple tool that we are going to talk about. It is called portupgrade. This is a handy software that allows you to manage your ports more efficiently.

I use portupgrade when I want to do things the easy way.

Lets give you a use case. You want to install a new piece of software that requires a library that you already have installed, for example, openssl, however the port fails because the dependency is too old of a version. Well, now you have find the updated port for openssl and uninstall and reinstall it. That might seem easy with one port. But now imaging you have a very new piece of software and you have to update a dozen or more ports. That is going to be time consuming. That is where portupgrade comes in. It does the hard work for you.

Step 1 – Make sure you have ports installed and updated
I already have a post on this. It is pretty short. Check it out here.
How to install ports on FreeBSD?

Make sure that even if you have installed ports that you update ports again so you have the latest.

Step 2 – Install portupgrade

  1. Log on as root.
    $ su
    Password:
    #
  2. Change to the ports directory and
    #
    #
    cd /usr/ports/ports-mgmt/portupgrade
    make BATCH=yes install

Step 3 – See which ports are outdated
The following command will show you which packages are up to date and which are not. Ok, you don’t really need portupgrade for this, because you can also run pkg_version which is part of base, but portupgrade seems to make a database and do this faster.

# portversion

Now, if you want to only see ports that are not up to date, do this:

# portversion |grep \<

Step 4 – Upgrade a port
Ok, now that portupgrade is installed, it is easy to upgrade a port.

# portupgrade portname

You can just copy and past the portname from the output of the portversion command.

Step 5 – Upgrade all ports
Ok, maybe you want to upgrade all your ports, and I am not saying you should, but maybe you want to. Here is a nice command that will do that for you.

# portupgrade -a -m BATCH=yes

Now that is not exactly complete, because we need to update the ports tree first. So do this:

# portsnap fetch update && portupgrade -a -m BATCH=yes

Now, on my FreeBSD box with an Xorg and KDE4 install, this has been going for over a day and isn’t done yet. I takes a long time to recompile all the Xorg, GTK, KDE4, and other miscellaneous ports.

Have fun with portupgrade.


Copyright ® Rhyous.com – Linking to this article is allowed without permission and as many as ten lines of this article can be used along with this link. Any other use of this article is allowed only by permission of Rhyous.com.