MacPorts: Continue installing other updates after error

Say I have the following outdated packages:

  • foo
  • bar
  • baz

I want to update as many as them as possible, so I try to run:

sudo port -n -f upgrade outdated

However this fails with:

Error: org.macports.build for port foo returned: command execution failed
Please see the log file for port foo for details: ...

How can I make macports try to upgrade bar and baz, if foo fails?

I would like to generally make macports try to install/upgrade other ports if installing/upgrading some of them fails and just continue.


From the man page:

 -f       force mode (ignore state file)

 

 -n       don't upgrade dependencies (affects upgrade and install)

Edit: foo, bar & baz, are 3 total unrelated ports, that doesn't depend on each other in any way.


Edit 2: Next time I run this the outdated ports might be a, b & c, instead of foo, bar & baz, so I can't hardcode the failing ones and I can't just do:

sudo port update foo
sudo port update bar
sudo port update baz

Solution 1:

The -p seems to work for me.

From the manpage:

-p       Despite any errors encountered, proceed to process multiple
         ports and commands.

Solution 2:

MacPorts dev here; the correct answer to your question is: you don't.

There is a reason why MacPorts doesn't attempt to install a package when a dependency fails to build.

This exact question has been discussed on the macports-users mailing list not so long ago:

  • “How to proceed past errors?”
    http://lists.macosforge.org/pipermail/macports-users/2012-July/029904.html
  • and its follow-up thread “-p considered problematic”
    http://lists.macosforge.org/pipermail/macports-users/2012-July/029984.html