Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 783
halloleo Avatar asked Oct 16 '22 10:10

halloleo


1 Answers

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

  • To view your status you need to:

csrutil status

  • To disable it (which is usually a bad idea):

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

  • To enable it (which should be turned back on when you are done):

csrutil enable

like image 80
tukan Avatar answered Oct 21 '22 07:10

tukan