37

Is this directory protected by Mojave's new security features?

$ sudo ls -laR /var/db/dslocal/nodes/Default/
ls: Operation not permitted

It works in High Sierra but not Mojave. How do we view the contents of this directory?

0
0

You can turn it of System Integrity Protection (the SIP) but be aware of potential risks.

to disable

Reboot the Mac and hold down Command + R.

From the Utilities menu, choose Terminal.

Type csrutil disable

To turn it back on --Highly Recommended !!

You can re-enable SIP by following the above steps, but using csrutil enable instead.

10
  • 3
    awesome. thanks so much. where did you learn to do that? is there some official SIP/Mojave documentation i can use to better understand technical details?
    – user306643
    Oct 17 '18 at 22:08
  • 11
    Disabling SIP is massive overkill, and completely unnecessary to solve the problem. It opens your system to all sorts of vulnerabilities. It's like removing your front door because someone needs to enter your house. See the answer about Full Disk Access in System Prefs for a better way.
    – benwiggy
    Dec 19 '18 at 10:41
  • 1
    @benwiggy Giving Terminal full-access is just as bad. I think I'd ask why the OP thinks he needs to be manipulating that directory. Dec 19 '18 at 21:07
  • 1
    I'd argue "less bad".
    – benwiggy
    Dec 19 '18 at 22:05
  • 1
    @Robin Perhaps you've heard of this thing called $PATH? Feb 26 '19 at 0:40
69

A less drastic way:

Go to System Preferences > Security & Privacy and give Full Disk Access to Terminal.

Adapted from https://discussions.apple.com/thread/8637915

8
  • 18
    Did not work for me in Mojave (v10.14.1) - I am still getting Operation not permitted
    – Robin
    Feb 25 '19 at 18:59
  • 1
    Worked for me on Mojave 10.14.4 using iTerm2 as my terminal.
    – Quantum7
    Apr 12 '19 at 6:44
  • 7
    Doesn't matter whether the terminal is closed or not. In any case, I can conform what Robin said for 10.14.5, it does not work (Terminal app is added to Full Disk Access list), even after a reboot. Jun 8 '19 at 20:19
  • 1
    I can confirm that this worked on macOS Mojave 10.14.6; closing Terminal was required (and prompted for with "Terminal.app" will not have full disk access until it is quit); rebooting the computer was not necessary. Thanks!
    – kayge
    Feb 23 '20 at 19:40
  • 2
    Solved error Operation not permitted on ls ~/Documents after upgrading to MacOS Catalina 10.15.5
    – Olivier
    Jun 6 '20 at 13:50
16

This did it for me

Steps:

 Apple menu -> System Preferences -> Security & Privacy -> Privacy -> Full Disk Access -> +

Choose:

Applications -> Utilities -> folder -> Terminal -> open/grant terminal full disk access privileges. -> Relaunch terminal

4
  • How does this differ from earlier answer apple.stackexchange.com/a/345142/237?
    – mmmmmm
    Sep 27 '19 at 11:55
  • 2
    @Mark It provides full steps, not partial steps which weren't enough for me to figure it out looking at the answer you mentioned, along with a guide that has pictures. Sep 27 '19 at 19:35
  • +1 for better steps, thanks! Jan 22 '20 at 4:52
  • +1 thanks for providing the step by step solution
    – Ani
    Mar 3 '20 at 2:58
2

In my case helped simply:
chflags -R nouchg .
This code I used in terminal in folder with problematic file.
Source: https://txcowboycoder.wordpress.com/2011/01/10/svn-cant-move-svntmpentries-operation-not-permitted/

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .