How can I view and manipulate directory contents that are hidden from root?

As root (!) I get this:

sh-3.2# pwd
/Users/madler/Library/Safari
sh-3.2# ls
ls: .: Operation not permitted

I'm not sure how even root is prohibited from looking at or modifying this (and other) directories, but it is. Is there a way around it?

As for what I'm up to, I would like to figure out where open tabs and windows are stored by Safari, and restore them from a backup. Safari lost them all somehow. I am able to see and retrieve the contents of that directory in the backup, but I am not able to replace the contents of that directory either with the restore function of the backup or manually as root.

I am running Mojave 10.14.6.


Yes, you can enable Full Disk Access for Terminal to get further access. Even further access to system files can be had by disabling SIP (System Integrity Protection) - although I would not recommend leaving it disabling in general.

You can enable Full Disk Access by opening System Preferences > Security & Privacy, and then under the "Privacy" tab select "Full Disk Access". After unlocking, drag Terminal.app into the list to give it full disk access.

SIP can be disabled by booting into Recovery Mode (reboot with Cmd+R held down), and then opening Terminal.app and running the following command:

csrutil disable

When you reboot, your Mac will start up with SIP disabled. You can run the same command again in Recovery Mode by replacing "disable" with "enable" in order to re-enable SIP after making the changes.