Fix Terminal “Operation not permitted” Error in MacOS Mojave

Oct 9, 2018 - 13 Comments

Fix Operation Not Permitted Terminal Error in Mac OS

If you’re a Mac command line user you may have noticed that many frequently used commands entered into the Terminal (or iTerm) result in an “Operation not permitted” error message since updating to MacOS Mojave 10.14 or later. The “Operation not permitted” error in the Terminal can be seen after issuing even simple commands like using ‘ls’ ‘mv’ and ‘cp’ within the users own directory, but also in many other directory locations on the Mac, and when trying to use many defaults commands. Obviously this type of error message makes navigating and using the command line in MacOS Mojave to be quite difficult if not impossible for many purposes. Don’t worry, the Terminal is not broken in new MacOS versions.

This walkthrough will show you how to fix “Operation not permitted” error messages seen at the command line in Terminal for Mac OS in Mojave 10.14 or later.

How to Fix “Operation not permitted” Error in Terminal for Mac OS

  1. Pull down the  Apple menu and choose ‘System Preferences’
  2. Choose “Security & Privacy” control panel
  3. Now select the “Privacy” tab, then from the left-side menu select “Full Disk Access”
  4. Click the lock icon in the lower left corner of the preference panel and authenticate with an admin level login
  5. Now click the [+] plus button to add an application with full disk access
  6. Click the Plus button to add Terminal to Full Disk Access in macOS

  7. Navigate to the /Applications/Utilities/ folder and choose “Terminal” to grant Terminal with Full Disk Access privileges
  8. select Terminal app to grant full disk access in MacOS

  9. Relaunch Terminal, the “Operation not permitted” error messages will be gone

If you have not encountered the “Operation not permitted” error message in the Terminal of MacOS (Mojave 10.14 or later) yet, then it’s likely because you haven’t wandered into a directory or file path that has the additional access restrictions (or that you don’t use Terminal, in which case this entire article is not for you).

While many of the various core System and root directories will throw error messages in macOS Terminal too, you can also find the error message even when trying to work in the users own Home directory, including in many of the user ~/Library/ folders, like ~/Library/Messages (where iMessage attachments and chat logs are stored in Mac OS) and ~/Library/Mail/ (where user-level mail plugins, mailbox data, and other Mail app data is stored), and many others.

You can test this yourself, before and after making the settings adjustment outlined above with a simple command like using ls on one of the protected folders:

ls ~/Library/Messages

If Terminal does not have Full Disk Access granted, you will see the “Operation not permitted” error message.

Operation Not Permitted error in Mac Terminal

If Terminal does have Full Disk Access granted, or if SIP is disabled, you will not see that error message in the MacOS Terminal.

Terminal working without error in macOS

In case you were wondering, yes that does mean there are actually two ways to fix the “Operation not permitted” errors you may encounter in MacOS Terminal; the first which we detail here is rather simple that grants additional access privileges to Terminal app, and the other is a bit more dramatic which involves disabling System Integrity Protection on the Mac which is generally not recommended and we won’t specifically cover here, though simply disabling SIP and rebooting is typically enough to make the error go away if you’d rather go that route.

The “Operation not permitted” message is one of a variety of command line errors you may encounter in Mac OS Terminal. Another frequently seen command line error is the the “command not found” error message which can also be encountered in the Terminal for MacOS for a variety of different reasons as well.

If you have any other tips, tricks, suggestions, or thoughts about the command line in MacOS or this particular error message, share with us in the comments below.

Enjoy this tip? Subscribe to the OSXDaily newsletter to get more of our great Apple tips, tricks, and important news delivered to your inbox! Enter your email address below:

Related articles:

Posted by: Paul Horowitz in Command Line, Mac OS X, Tips & Tricks, Troubleshooting

13 Comments

» Comments RSS Feed

  1. Anthony says:

    The issue I have isn’t the Terminal getting that message; but the Finder, when manually copying files from one tab to another in the same Finder Window. If in two separate windows, it works; but when the Dock PreferencePane’s “Prefer tabs when opening documents” is set as Always, I get the error. Anyone experience this and any solutions? I could in theory add the Finder.app found in /System/Library/CoreServices; but this is a very risky kludge and not a valid solution.

  2. Tom says:

    I have a cron job that runs rsync to backup my home directory to another machine. Since Mojave I’m always getting errors from it. I can run it fine from Terminal because I gave full disk access to Terminal, but I haven’t found a way to give permission to cron or rsync, which are plain unix executables. I believe you can only give permission to apps. Any advice?

    • Liam says:

      I Don’t have a solution for you, but this is the sort of crap from Apple that keeps me from updating/upgrading… Tim Cook assumes that all Apple users are all brain dead morons.

  3. Mark says:

    Does this happen even if you are root? I currently don’t have a machine capable of running Mojave so cannot test this. But from the sounds of thing, Apple is making their OS like their hardware, unable to open or look inside anymore.

  4. Leen Couprie says:

    Thanks!
    this also solves issues with Macscan and PrivacyScan.
    add these to the applist too!

    • racinu says:

      Granting apps full disk access has potential for problems, with Terminal it makes sense if you are a terminal user but for others it’s not a good idea to randomly add apps to that list. This is a protection mechanism in new macOS.

      That makes me wonder, what is MacScan and PrivacyScan? What do they claim to do and what makes them? Be wary of junk cleaner apps that aren’t needed by the Mac. Be wary of apps that claim to scan or clean anything, they’re usually junkware trying to put more junk and tracking on your Mac.

      Strict Gatekeeper settings and privacy settings, only trusted source apps, Malwarebytes free edition, regular web browser cache and cookie removal, some of the ObjectiveSee apps, that’s really all you should need on a Mac if anything at all. Don’t download sketchy stuff from anywhere and that alone prevents most problems on Mac.

  5. Stella says:

    Thanks for the pictorial representation.. this really helped me to solve my issue. Thanks a lot.

  6. not spam says:

    Another reason not to upgrade?

    Looks like crApple is charging ahead with converting all OS’s to iPads where users have ZERO control over their devices because computers are now considered AD delivery and tracking devices and users are captive audiences.

  7. Richy B says:

    Since upgrading to Mojave, when trying to run flush.app flash cookie remover, I get an error message:

    Not authorized to send Apple events to Terminal (-1743)

  8. bigdork says:

    more Apple stupidity! Why do they not listen to users! Each and every update continues to hobble and restrict the OS to something completely useless and unusable by anyone with significant skill! Take your crap OS APPLE and keep making it utterly useless! Moving on to real operating systems from Red Hat, Windows were users can still actually accomplish work and configure systems as needed!

    Good luck trying to sell anything you stick a PRO label on with an OS this useless

  9. IronCraftMan says:

    This is really disappointing to hear. I was on a Windows machine the other day and couldn’t delete a file. Tried using the command line as admin and various applications. It made me think about why I prefer Mac over windows, one of the reasons being that I (the user) have complete control over the OS. Guess Apple is now deciding that after almost 20 years of macs running OS X that users shouldn’t have access to one of the core features- the unix/bsd base system.

  10. DG12 says:

    Is there a list of “restricted” directories?

Leave a Reply

 

Shop on Amazon.com and help support OSXDaily!

Subscribe to OSXDaily

Subscribe to RSS Subscribe to Twitter Feed Follow on Facebook Subscribe to eMail Updates

Tips & Tricks

News

iPhone / iPad

Mac