How to Fix “Operation Not Permitted” in Mac Terminal

Updated

Learn how to quickly fix the "Operation Not Permitted" error in macOS

How to Fix “Operation Not Permitted” in Mac Terminal

This error happens when macOS security restrictions block an application like Terminal from accessing protected folders, and all you need to fix it is administrator access to your Mac.

  1. To start, open System Settings by pressing command + space, typing System Settings, and pressing enter.
  2. In the left sidebar, click Privacy & Security.
  3. Next, scroll down on the right side and click Full Disk Access. Look for the app you are trying to use, such as Terminal or iTerm, and click the toggle switch next to it to turn it on.
  4. If your application is not listed, click the "+" icon at the bottom of the list, enter your Mac password, select your application from the list, and click Open.
  5. When you turn on the permission, macOS will prompt you to restart the application, so click Quit & Reopen and wait a moment for the app to reload.
  6. To test that everything works, go back to your terminal or app and run your command again, or type ls ~/Desktop to verify that your Mac can now access the folder without errors.

As a quick tip, only grant Full Disk Access to tools and applications you completely trust to keep your system secure.