Ran into the same problem tonight as this question from SO that wasn't fully answered.
I'm trying to uninstall an old installation of MacPorts, and run into SIP:
mybox:~ me$ sudo rm -rf /opt/local 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
According to the original question, the answer seems to involve SIP… but why has SIP decided to protect this (empty) directory?
EDIT: Here's the results of
ls -a in the directory:
And here's the results of
ls -leOd /opt/local/var/macports/home/Library/Preferences:
drwxrwxrwx 2 root wheel - 64 Nov 8 19:45 /opt/local/var/macports/home/Library/Preferences/
Here's the results of
ls -laeO@ /opt/local/var/macports/home
drwxr-xr-x 3 root wheel - 96 Nov 8 19:42 ./ drwxr-xr-x@ 3 root wheel - 96 Nov 8 19:45 ../ com.apple.FinderInfo 32 drwxr-xr-x 3 root wheel - 96 Nov 8 19:42 Library/