macosfile-iosudo

How to avoid "Operation not permitted" on macOS when `sudo` and `bypass` don't do the trick


On macOS (High Sierra) when I attempt to list the file at the path

/private/var/db/ConfigurationProfiles/Store

I get the error "Operation not permitted". Using sudo doesn't better it and even employing the bypass helper doesn't change anything:

sudo /System/Library/Extensions/TMSafetyNet.kext/Contents/Helpers/bypass ls -l /private/var/db/ConfigurationProfiles/Store

gives "Operation not permitted" as well. How can I list/access the file under the path /private/var/db/ConfigurationProfiles/Store?

Additional info:

An list of the the enclosing directory via ls -al /private/var/db/ConfigurationProfiles displays:

drwxr-xr-x   5 root  wheel   160 13 Apr  2018 .
drwxr-xr-x  85 root  wheel  2720 28 Sep 06:27 ..
drwxr-xr-x@  4 root  wheel   128 16 Dec  2017 Settings
drwx------   3 root  wheel    96  1 Oct 21:56 Setup
ls: Store: Operation not permitted

Consistently, but rather strangely Store cannot be listed. This happens both when executing ls as current user and via sudo.


Solution

  • Most probable reason is the system integrity protection (SIP) - csrutil is the command line utility. You need to disable it to view the directory.

    csrutil status

    csrutil disable (then you will probably need to reboot).

    csrutil enable