In some cases, you got the following error when you list the contents inside a folder on your Mac.
In a Mac you would get the error ls: : Operation not permitted if the Terminal doesn’t have Full Disk Access permission. To fix it, you need grant the permission to the Terminal app.
1. Click on the Apple icon in the top-left corner of your screen and select System Preferences.
2. In the System Preferences window, select Security & Privacy.
3. In the Security & Privacy window. Select the Privacy tab.
4. Click the lock icon then enter your password to make the changes.
5. Scroll down to Full Disk Access in the left panel then select the checkbox to grant permission to Terminal app.
6. New pop-up appears, let’s click on Quit & Reopen button then check if the error was gone.
As you can see, the error was gone.
Last login: Tue Nov 22 13:19:17 on ttys000
bonben@flame01 ~ % cd .Trash
bonben@flame01 .Trash % ls
AnyDesk 17.45.06.app Telegram.app
AnyDesk.app Telegram.dmg
BetterDisplay-v1.3.4.dmg VSCode-darwin-universal.zip
Chrome Remote Desktop Host Uninstaller.app anydesk 16.16.36.dmg
InstallOS.dmg.download anydesk.dmg
Monterey.dmg chromeremotedesktop (1).dmg
QuickRes_4.8.dmg chromeremotedesktop.dmg
QuickRes_4.9.dmg dmg
SwitchResX v4.12.2.dmg googlechrome.dmg
TeamViewer.dmg