Recently when I tried to run ls command in the Mac Terminal Zsh shell on macOS Big Sur, I got the below error,
code2care@mac % ls
ls: .: Operation not permitted
This was really weird, I was able to fix this issue by following the below steps,
- Click on the Apple logo on Menu Bar,
- Select System Preferences...
- Click on Security & Privacy,
- Select Files & Folders,
- Under - Allow the Apps below to access files & folders, look for terminal and check - Desktop Folder, you will get the below alert,
"Terminalโ will not have access to files on your desktop until it is quit.
You can choose to quit โTerminalโ now or do it on your own later. - Click on Quit & Reopen
- You will not be able to access ls and other commands in desktop.

Security and Privacy Option

Select Desktop folder from Files and Folders
โ๏ธ You can get such an error while trying to access Network volumes, Download, or Documents folder if the option in Files and Folders is unchecked for Terminal.
More Posts related to MacOS,
- How to connect AirPods to Mac
- Display Safari URL address link on hover
- Mac turn dark mode on or off using terminal command
- Docker Desktop needs privileged access macOS
- How to install Java on macOS [Big Sur]
- How to start/boot macOS in safe mode - Big Sur 11.0, Catalina 10.15, or Mojave 10.14
- Find Mac version using terminal command
- How to fix command not found brew (bash, zsh) on macOS Terminal
- How to change default macOS Terminal Window size
- How to make EditText text to uppercase or lowercase on macOS
- Disable Startup Sound on macOS
- How to switch from bash to zsh shell in macOS Terminal
- How to make macOS Terminal window Transparent (or Opaque)
- Remove Now Playing icon from macOS Big Sur Menu Bar
- Test internet speed using macOS Terminal command
- How to change macOS Safari default language
- Encode or Decode Base64 String using Mac Terminal Command
- Safari - Get HTTP Request Response Headers
- How to open terminal on Mac to run commands
- How to install homebrew (brew) on M1 Mac
- How to display directory tree in Mac Terminal
- How to Change Mouse Wheel Scroll Direction on Mac
- MacoOS - xyz is an app downloaded from the internet. Are you sure you want to open it? Alert
- The default interactive shell is now zsh. [macOS]
- Change Terminal Cursor Type in Mac (MacOS Shell)
More Posts:
- Add Blank Lines Between Each Lines in Notepad++ - NotepadPlusPlus
- Fix error The tool was unable to install the Web Server (IIS) Role during SharePoint 2019 Setup - SharePoint
- How to make EditText text to uppercase or lowercase on macOS - MacOS
- PHP 301 Redirect Permanently - PHP
- Fix Microsoft Office 365 error code 135011 - Your organization has disabled this device - Microsoft