Can not remove the new MacPorts Mojave package

Dr M J Carter Martin.Carter at
Fri Nov 9 10:31:39 UTC 2018

On Wed, Oct 03, 2018 at 01:25:28PM +0100, Chris Jones wrote:
> On 03/10/18 13:16, S. L. Garwood via macports-users wrote:
> > I installed the new Macports bundle mentioned in Josha Root’s email.
> > Install went fine, but now it will not uninstall — doing the “rm”
> > commands in /opt/local gets a series of errors
> > 
> > rm: /opt/local/var/macports/home/Library/Preferences: Operation not
> > permitted
> > rm: /opt/local/var/macports/home/Library: Operation not permitted
> > rm: /opt/local/var/macports/home: Operation not permitted
> > rm: /opt/local/var/macports: Directory not empty
> > rm: /opt/local/var: Directory not empty
> > rm: /opt/local: Directory not empty
> > mymbp:~ slgarwood$
> *Exactly* what command are you running ? Are you running it through sudo ?
> (your regular user account will not be owning /opt/local)

I can reproduce this exactly and repeatedly, and I've been banging my
head on it for a fortnight.  Our nightly build scripts succeed once,
but the next attempt fails to remove the above directory, and the
build dies aborning.  The actions in the Makefiles, shorn of
interlocks and safety traps, boil down to:

# .... disable any MacPorts daemons
port -u uninstall # succeeds
port -q uninstall all # succeeds
killall -TERM -u macports # succeeds
rm -rf /Applications/MacPorts/* # succeeds
for strike in 1 2 3 4 5 out ; do \
         if [ -z "`echo /opt/local/*`" ] ; then \
          echo "+++ Info: dir empty" ; \
          exit 0 ; \
         elif rm -rf /opt/local/* ; then \
          echo "+++ Info: rm succeeded" ; \
          exit 0 ; \
         else \
          echo "+++ Info: Strike $strike" ; \
          [ "$strike" != "out" ] || exit 1 ; \
          sleep 5 ; \
         fi ; \
# fails

This is all done by a sargasso of Makefiles and shell scripts, kicked
off in the background using either sudo or root's crontab.  (I'll
leave my adventures with atrun for another day.)  Please find enclosed
the logfile for this morning's attempt, which shows a failure to
uninstall font-misc-ethiopic (which may or may not be relevant).

My current theory stems from noting that the offending directory is
~macports/Library/Preferences, hence the killall above; but by the
time I get to see the result, whatever process is holding down that
directory is long gone (so a reattempt would succeed).  Frustratingly,
an empty build fails to fail, and a full build takes twelve hours or
more; as Mr Micawber would say, "result Misery".  I'm doing a reduced
test build as we speak, after which I'll try running the offending
Make target by hand using sudo.

All suggestions welcomed: we can't roll out Mojave in production till
this is fixed or worked around.  Thanks in advance.

Dr Martin J Carter
Computer System Administrator
Astrophysics, University of Oxford

More information about the macports-users mailing list