ls
command in Terminal. This is a commonly used command to display the contents—files and directories—within a specific path. I need to know what's there before I do anything.ls Error
- MyMac-MBP13:~ auser$ ls
- Applications Untitled.html
- Desktop downloadtemp
- Documents iCloud Drive (Archive)
- Downloads iCloud Drive (Archive) - 1
- Library iCloud Drive (Archive) - 2
- Movies test
- Music test.aiff
- Pictures test.html
- Programming tmp
- Public vc.swift
- Sites
- MyMac-MBP13:~ auser$ cd ~/Library/Application\ Support/MobileSync/
- MyMac-MBP13:MobileSync auser$ ls
- ls: .: Operation not permitted
- MyMac-MBP13:MobileSync auser$
After searching online, I discovered that this issue is due to a security enhancement introduced by Apple in the latest macOS: System Integrity Protection (SIP). By default, the Terminal app does not have the privilege of Full Disk Access
. My current macOS version is Sequoia 15.3.2.
Change System Settings
According to a solution on the CleanMyMac blog titled “How to fix the ‘ls: .: operation not permitted’ error in Terminal,” I needed to adjust a setting in System Settings.
Initially, when I navigated to Privacy & Security
, I couldn’t find the Full Disk Access
option.
I wasn’t sure where the setting was—until I tried searching for “Full Disk.”
I turned it on.
The hidden setting was revealed. As expected, Terminal did not have Full Disk Access
by default. I enabled it by entering my admin password. Now, the ls
command works anywhere in the console, after re-opended.
- MyMac-MBP13:Application Support auser$ ls Mob*
- Backup
- MyMac-MBP13:Application Support auser$
Revert the Setting (Optional)
I believe Apple’s SIP is a great safety feature. After finishing my work in Terminal, I turned off Full Disk Access
for the Terminal app to restore the default setting. I’m writing this blog post for future reference, in case I need to do similar work in Terminal again.
References
- CleanMyMac blog: How to fix the "ls operation not permitted error"