If you see “Operation not permitted” on macOS Mojave, it usually means the Terminal (or another app) lacks Full Disk Access or the file is protected by System Integrity Protection (SIP). You can fix it by granting Full Disk Access in System Preferences, or by temporarily disabling SIP for system files (not recommended). Below is a detailed guide covering the causes, step-by-step fixes, and related background.
Why macOS Mojave Shows This Error
macOS Mojave (10.14) introduced a stricter privacy model. Apps that want to access protected areas like Desktop, Documents, Downloads, Photos, Mail, Messages, and Time Machine backups must be explicitly granted permission. This is part of Apple’s Transparency, Consent, and Control (TCC) framework. When you try to read or write to these locations from an app like Terminal, and that app hasn’t been approved, the system returns Operation not permitted (errno 1).
Additionally, System Integrity Protection (SIP) protects system-owned files and directories. Even with Full Disk Access, you cannot modify certain system files unless you disable SIP (which has security implications).
Fix 1: Grant Full Disk Access to the App
The most common fix is to give the app (usually Terminal) Full Disk Access. Here’s how:
- Open System Preferences (from the Apple menu).
- Go to Security & Privacy → Privacy tab.
- In the left sidebar, scroll down and select Full Disk Access.
- Click the lock icon at the bottom left and enter your admin password.
- Click the + button, navigate to Applications → Utilities, and select Terminal (or the specific app showing the error).
- After adding, make sure the checkbox next to Terminal is checked.
- Restart Terminal (or the app) for the change to take effect.
If the app isn’t in the list, you can also drag its icon from Finder into the Full Disk Access list. After granting, test the operation again.
Fix 2: Reset Permissions for Specific Files/Folders
If you’re getting the error on a file you own (like a file in your home folder), it might have incorrect POSIX permissions. Use ls -l to check the owner and permissions. To fix, run:
chown $(whoami) /path/to/file chmod u+rw /path/to/file
Replace /path/to/file with the actual path. This often resolves “Operation not permitted” when the file is owned by root or has read-only flags.
Fix 3: Disable System Integrity Protection (SIP) – Only for System Files
If you’re trying to modify system files (e.g., in /System or /usr), SIP will block even with Full Disk Access. To override, you must disable SIP. This weakens macOS security and is not recommended for daily use. If you must, here’s the temporary method:
- Restart your Mac and hold Command+R to enter Recovery Mode.
- Open Utilities → Terminal.
- Type
csrutil disableand press Enter. - Reboot. After you’re done, re-enable SIP by following the same steps but with
csrutil enable.
In most cases, you should instead find a way to work within SIP’s rules—for example, by using a different folder or copying the file to your home directory.
Fix 4: Check for File Flags (uchg, schg)
macOS allows files to have flags like uchg (user immutable) or schg (system immutable). These prevent modification even by the owner. To check flags, run:
ls -lO /path/to/file
If you see uchg or schg, clear them with:
chflags nouchg /path/to/file chflags noschg /path/to/file
You may need sudo for schg. This is a common cause when trying to edit files that were locked by an installer or Time Machine.
Why You Shouldn’t Just Disable SIP
System Integrity Protection is a security feature that prevents even root users from modifying critical system files. Disabling it can expose your Mac to malware that can then alter system components. It also causes issues with macOS updates, which expect SIP to be enabled. Only disable it temporarily for specific development or troubleshooting, and re-enable immediately after.
Frequently Asked Questions
Why does Terminal get “Operation not permitted” on my Desktop files?
Because macOS Mojave and later protect Desktop, Documents, and Downloads by default. Terminal must be granted Full Disk Access (as described above) to read/write those folders. Without it, any command like ls ~/Desktop may return the error.
I granted Full Disk Access but still get the error. What now?
First, restart the app (or Terminal). If it still fails, check if the file itself is locked (use ls -lO). Also verify that you granted access to the correct app—for example, if you use iTerm2, you must grant access to iTerm2, not just Terminal. If you’re using a script that calls another binary, that binary may also need access.
Can I give Full Disk Access to all apps at once?
No, macOS requires you to grant access per app. There is no global “allow all” switch. You must add each app individually in System Preferences → Security & Privacy → Privacy → Full Disk Access.
Does this error occur on newer macOS versions too?
Yes, the Full Disk Access requirement persists in all versions after Mojave, including Catalina, Big Sur, Monterey, and later. The steps are similar, but the System Preferences interface may look slightly different (in Ventura and later it’s called System Settings).
What is the difference between “Operation not permitted” and “Permission denied”?
“Permission denied” (errno 13) typically means the file’s POSIX permissions don’t allow your user to access it. “Operation not permitted” (errno 1) often indicates a TCC privacy restriction or SIP protection. The fixes differ: for permission denied, you change file permissions; for operation not permitted, you grant Full Disk Access or disable SIP.
Is there a way to bypass this without disabling SIP?
Yes, for most tasks you can copy the file to a non-protected location (like your home folder), edit it there, and then copy it back if you have write permission. For system files, you can sometimes use sudo if the file is not SIP-protected, but many are. Always try the least invasive method first.
Related
General steps for current mainstream versions; menus can differ by device and version. See the disclaimer or report an error.
More in this bed
- Fix Apps Not Downloading From Play Store
- Secure a Samsung Galaxy After a Zero-Day Disclosure
- What to Check Before Installing Linux Alongside Windows
- Fix OEM Activation Error 0xc004c060 in Windows 10
- Why Does My App Run One Query for the List and One per Item?
- Fix Google Chrome Has Stopped Working