What is Error “Operation not permitted” on Mac? How to Fix It

While working on the macOS command line, you can sometimes encounter an “Operation not permitted” error message. This then makes it difficult for you to navigate through the terminal and issue commands to your system.

Usually, a macOS security feature known as Full Disk Access is responsible for this error popping up on your screen. Disabling Full Disk Access can restrict you from accessing files in certain locations and directories. So when the terminal tries to access the particular file/folder, the system doesn’t permit it to run the command(s).

However, there are other factors to consider as well, and we shall skim past all those causes down below. But rest easy knowing that this problem can be solved by taking some very easy and surefire steps.

What is “Operation not permitted” Error on Mac? How to Fix It

Why Am I Seeing This Error Message?

So, along with the one mentioned above, here are all the reasons you might be seeing the “Operation not permitted” error on your screen:

  • Full Disk Access
  • Locked Files
  • An unsuitable file directory
  • System Integrity Protection

What is “Operation not permitted” Error on Mac? How to Fix It

There are a few different ways to fix this error on your system. We shall go through all those ways, one step at a time. So, by the end of this article, we guarantee that you’ll no longer see this prompt on your terminal screen.

Enable Full Disk Access

You can give the terminal access to the entire disk through the System Preferences. Doing so will allow the system to modify files and folders present in every nook and cranny of your system. And then, you’ll no longer get the “Operation not permitted” error message.

See also  How to install macOS on VirtualBox in minutes with "macos-guest-virtualbox.sh"

From the menu bar, go to Apple > System Preferences.

Click on Security & Privacy settings.

Click on the lock and enter your admin password to allow new changes.

Navigate to Privacy.

Select Full Disk Access from the left panel.


full-disk-access-1024x882

Now, click ‘+’ to give selected applications full disk access.

 Select Terminal from the list of applications and Open it.

Go back to Full Disk Access and make sure that the Terminal is marked for full access.


full-disk-access-terminal

If prompted, Quit & Reopen the terminal.

Finally, click on the lock to save your changes.

Unlock Locked Files

If you’re trying to access a file via the terminal and notice that the operation is not permitted to continue further, chances are that the particular file is locked. A locked file cannot be altered or modified in any way. So, to prevent this ongoing issue, you can specify the file path in the Terminal and enter a set of commands to unlock it.

Press Command + Space to open Spotlight.

Type and go to Terminal.

Enter this command:
chflags nouchg /*file path*


chflags

For e.g. chflags nouchg /Maschitosh HD/Library/Preferences/abc

Type exit to exit the terminal.

Disable SIP

Like Full Disk Access, another macOS security feature known as System Integration Protection (SIP) can also influence disk permissions and operations. Apple implemented the SIP security standard on macOS to ensure that no system files are unnecessarily altered or modified.

However, you can easily bypass this security feature through the command line. But, we recommend you do so temporarily as the SIP works to maintain your system’s stability and its overall health.

See also  What is mds_stores on Mac? Why Does It Have High CPU Usage

The SIP has to be disabled before the OS fully loads up. Hence we’ll be accessing the macOS recovery window to enter a set of commands and disable SIP. So,

On Intel Macs

Restart your computer.

As soon as the system begins to start up again, hold Command + R until you see the Apple icon.


cmd-r

Then, from the menu bar, go to Utilities > Terminal.

Type csrutil disable and hit enter.

Then, enter reboot to restart your computer normally.

On Apple Silicon Macs

Shut down your computer.

Hold Power and startup your system.

Release the hold only after you see the startup Options.
startup-options-1

Then, go to Options.

Now, from the menu bar, go to Utilities > Terminal.


utilities-terminal

Type csrutil disable and hit enter.

Then, enter reboot to restart your computer normally.

Now, if and when you want to enable the SIP feature, go to Utilities > Terminal the same way as mentioned above and run the csrutil enable command instead. 

Similarly, to check the SIP status of your device, run the command csrutil status and look for either the ‘System Integrity Protection status: enabled’ or ‘System Integrity Protection status: disabled’ message.

Change File Directory

While skimming through various forums, we noticed that plenty of users encountered the “Operation not permitted” error message while trying to access a file in /usr/bin directory of your computer. Furthermore, for those users, transferring that particular file to /usr/local/bin seemed to fix the problem.

/bin stands for ‘Binary’. That is, this folder stores executable commands to execute certain functionalities on your installed application. Since a wrong move can greatly alter your app’s configuration setting, we recommend you follow this method if nothing else works.

See also  Can You Enable “Do Not Disturb” on Your Computer? ( Windows and Mac)

From the menu bar, click on Go > Computer.

Select your main disk drive (by default, named Macintosh HD).

Then, press Shift + Command + . (period) to view hidden files.

Now, navigate to usr > bin folder.


usr-bin-1024x478

Copy the required file(s) and paste it on usr > local > bin folder. 


usr-local-bin-1024x478

Restart your computer.

End

"Because of the Google update, I, like many other blogs, lost a lot of traffic."

Join the Newsletter

Please, subscribe to get our latest content by email.

Mohamed SAKHRI
Mohamed SAKHRI

I'm the creator and editor-in-chief of Tech To Geek. Through this little blog, I share with you my passion for technology. I specialize in various operating systems such as Windows, Linux, macOS, and Android, focusing on providing practical and valuable guides.

Articles: 1454

Newsletter Updates

Enter your email address below and subscribe to our newsletter

Leave a Reply

Your email address will not be published. Required fields are marked *