"Operation not permitted" error occurs when doing "ls" in my .~/Trash directory

Hi all,


I get the error "ls: .: Operation not permitted" when I try to do an "ls" in my ~/.Trash directory. I've attached a screen grab so you can see the command history.


I can't figure out what the problem could be... not the sticky bit or the set uid or set gid bits....


Since I've come across a few of these types of behaviors on macOS, I would appreciate it if one of the Apple folks (or anyone else who might be privy to the mysterious inner workings) would point me to some good overview of the inner workings of macOS.


Thanks in advance,







iMac 27", macOS 10.15

Posted on Dec 12, 2019 10:54 PM

Similar questions

5 replies

Dec 13, 2019 9:26 AM in response to LD150

Hi,


Neither flag causes the error. I get the same error even if no flags:

$ ls
ls: .: Operation not permitted
$ 
$ 


I just fired up bash from the Terminal application icon. I have done no customization to my system, no third-party software shells, no extensions, nothing. It's the bash that comes with Catalina.


I can delete individual files from trash and I can "empty trash" using the trash can icon in the dock.



Dec 13, 2019 12:11 PM in response to LD150

Hi,


Sorry for the confusion. I showed the "ls -ld" to show the permissions on the ~/.Trash directory. I guess I should have done the following:


$ cd
$ ls -al | grep Trash
$


Doing "sudo ls" does not work. I am in the admin group, yes.

$ sudo ls 
$ ls: .: Operation not permitted
$ 
$ groups
staff com.apple.sharepoint.group.1 everyone localaccounts _appserverusr admin _appserveradm _lpadmin _appstore _lpoperator _developer _analyticsusers com.apple.access_ftp com.apple.access_screensharing com.apple.access_ssh com.apple.access_remote_ae
$ 
$ 


Thanks,


This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

"Operation not permitted" error occurs when doing "ls" in my .~/Trash directory

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.