I know this error is infuriating. You type a simple ls into Terminal and get Operation not permitted for your own files. This tripped me up the first time I saw it on Mojave, and it's still haunting users on Sonoma. The good news: the fix is usually quick.
The Direct Fix: Grant Full Disk Access to Terminal
- Open System Settings (or System Preferences on older macOS).
- Go to Privacy & Security → Full Disk Access.
- Click the lock icon and enter your password.
- Click the + button, then navigate to Applications → Utilities and select Terminal (or your preferred terminal like iTerm).
- Quit Terminal completely (
Cmd+Q), then reopen it.
That's it for most cases. If Terminal already had access, toggle it off and on again. This forces macOS to refresh the permission grant. I've seen this work on Catalina, Big Sur, Monterey, Ventura, and Sonoma.
Skip the “reset” button in Privacy settings—that nukes everything. You want to just flip the switch.
Why This Works
Since macOS Mojave (10.14), Apple introduced TCC (Transparency, Consent, and Control). TCC tracks which apps can touch protected folders like Desktop, Documents, Downloads, and even your Photos library. When you upgrade macOS or restore from a backup, TCC sometimes loses track of what you already allowed. The result? Even though you're the admin and the owner, Terminal gets shunned.
Granting Full Disk Access tells TCC “this app is okay.” Toggling it off and on forces the system to re-evaluate the permission, which clears stale flags that cause the error.
When Full Disk Access Isn't the Culprit
Sometimes the error appears for a specific folder or file, not everywhere. Here are the less common variations I've seen:
1. You're Trying to Access a File Owned by Another User
If you're using sudo and still get “Operation not permitted,” check the file's flags:
ls -lO file.txt
Look for restricted or uchg in the flags column. uchg means the file is immutable—even root can't modify it. Remove it with:
sudo chflags nouchg file.txt
This happened to me with a downloaded DMG that had the quarantine flag set. It's rare but maddening when it happens.
2. Terminal Is Not the Only App with the Problem
If you see the error in Finder or other apps, it's likely a broader TCC issue. A quick reset of the TCC database can help, but be careful—this logs out your apps from privacy permissions. To do it, boot into Recovery Mode (restart and hold Cmd+R), open Terminal from the Utilities menu, and run:
csrutil disable
Then restart normally and run:
sudo tccutil reset All
Re-enable SIP with csrutil enable after. This nukes all privacy permissions, so you'll have to re-grant them. Only do this if you're comfortable with that trade-off.
3. The Folder Has a Special Attribute
macOS treats certain folders as “protected” even for admin users. The ~/Library folder is a classic example. If you're trying to access ~/Library/Application Support via Terminal without Full Disk Access, you'll hit the wall. The fix is the same—grant Full Disk Access to your terminal app. There's no workaround via chmod or sudo because TCC sits above Unix permissions.
Prevention: Keep This from Happening Again
The best way to avoid this error is to be proactive about permissions after every macOS update. Here's what I do:
- After a major macOS upgrade, check System Settings → Privacy & Security → Full Disk Access. Look for any app that has a greyed-out toggle or missing entry.
- If you use multiple terminal apps (like iTerm, VS Code's terminal), grant them all Full Disk Access at the same time. Don't wait for the error.
- When you clone a Mac or restore from Time Machine, re-grant permissions for your dev tools before you start working. TCC doesn't always migrate cleanly.
One more thing: don't run sudo chmod -R 777 on your home folder to bypass this. That breaks security and can make your Mac unstable. The proper way is always through TCC.
This error is a pain, and Apple could definitely explain it better. But once you know it's a permission handshake issue, it's easy to resolve. If none of these steps work, check if your Mac has a managed profile (like from a work or school) that blocks changes. That's a whole different beast, and you'll need your IT admin to help.