Announcing: port_upgrade

Mike Alexander mta at
Sat May 16 13:40:47 PDT 2009

--On May 9, 2009 2:05:41 PM -0700 Tony Doan <tdoan at> wrote:

> Got MacPorts?
> Do you normally keep things up to date by running "port sync; port
> upgrade outdated"? Do you then wish there was a problem free way to
> clean out all the previous versions?
> Well then... have I got some beta software for you!
> port_upgrade is a no holds barred brute force way to upgrade your
> ports tree when things are out of date. port_upgrade crawls your
> receipts directory and your sources directory and figures out what is
> out of date. It then builds a dependency tree and uninstalls
> everything in dependency order then reinstalls everything in reverse
> order. Along the way you get the most up to date versions of your
> ports, you are assured higher level ports are compiled against the
> most recent versions of libraries and generally a nice clean ports
> tree. You also get quite a long wait while things are recompiled and
> reinstalled. It preserves specified variants (either specified
> explicitly or implicitly). If port_upgrade encounters two versions of
> a port installed where the variants differ you will be prompted which
> to use.

I think some of the posts regarding this package may have missed the 
point slightly.  If a port is outdated it will rebuild that port and 
all the other ports that depend on it, whether or not those ports are 
also outdated.  I don't think there is any command in MacPorts that 
will do this, but perhaps I'm missing something.

Being one of the (few?) people who installed the X11 ports using the 
+system_x11 variant and who, as a result, needs to rebuild everything 
that depends on anything using that variant, even if it is not 
outdated, this package seems like it would be useful.  I do agree with 
others who have said it would be better if it were part of the base 
MacPorts system.

I tried to use it to clean up after system_x11 and have a couple of 
suggestions for improvements.  First, I had to change the value of 
MACPORTS_DB in port_upgrade.rb since I use SVN to keep the ports data 
base up to date.  There is a parameter to override the location of the 
receipts but I can't find one to override the location of the port 
files.  This would be useful.

It also seems like it would be useful to include a "clean" action in 
the generated shell script that would do a "port clean --work 
--archive" on all the relevant ports.  Or perhaps just include this in 
the "uninstall" action.  If you've installed ports with the autoclean 
option off and MacPorts thinks they aren't out of date, it won't 
rebuild them.


More information about the macports-users mailing list