Can't clear ACL on macOS file - Operation not permitted

I have a MacBook Pro with an external USB hard drive. A program I wrote is having trouble reading the files in Backups.backupdb so I look at the permissions:

> pwd
/Volumes/G-DRIVE
> ls -led Backups.backupdb 
drwxr-xr-x+ 7 rob  staff  238 Feb 10  2012 Backups.backupdb
 0: group:everyone deny add_file,delete,add_subdirectory,delete_child,writeattr,writeextattr,chown

This is an older drive. I no longer use it for Time Machine backups, so I don't care if I clear out permissions that used to protect this folder

But I can't clear them:

> sudo chmod -N Backups.backupdb
> chmod: Failed to clear ACL on file Backups.backupdb: Operation not permitted

Attempts to find some hidden attribute that might be preventing the chmod:

> ls -ldO Backups.backupdb 
> drwxr-xr-x+ 7 rob  staff  - 238 Feb 10  2012 Backups.backupdb
> xattr Backups.backupdb 
[nothing]

Why is the operation not permitted?

I just used Disk Utility to look at the drive. It didn't find any problems.


I found an answer to my own question.

I don't know if this is new to macOS 11 Big Sur. I had to go to System Preferences → Security & Privacy → the Privacy tab. Then select "Full Disk Access" in the list on the left, and enable the checkbox for Terminal. It restarted Terminal and then I was able to run the usual commands to chmod, as well as view the directory contents.


Being unable to do operations even with sudo is usually caused by System Integrity Protection. This answer describes a similar issue, and also describes how to disable SIP (and re-enable it when you're done).