Stack Exchange Network

Stack Exchange network consists of 183 Q&A communities including Stack Overflow , the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Q&A for work

Connect and share knowledge within a single location that is structured and easy to search.

Operation not permitted

I am trying to delete files from trash on my MacBook. I have tried to remove with:

Can not remove all files from Trash in OS X

But I get Operation not permitted error

Any help is appreciated.

NathanGL's user avatar

  • What you are trying to do is empty at the same time your own Trash / Recycle Bin and the system's. Some items may have been marked for deletion pending a reboot by the OS, but they will be deleted at its discretion, not yours. What happens if you just try a "sudo rm -rf ~/.Trash"? –  user1019780 Commented Jun 11, 2020 at 11:23
  • @Didier Still the same rm: /Users/Admin/.Trash/2e4/SafariFamily: Operation not permitted rm: /Users/Admin/.Trash/2e4/com.apple.Safari/SafariFamily: Operation not permitted rm: /Users/Admin/.Trash/2e4/com.apple.Safari: Directory not empty rm: /Users/Admin/.Trash/2e4/SafariFamily: Operation not permitted rm: /Users/Admin/.Trash/2e4/com.apple.Safari/SafariFamily: Operation not permitted rm: /Users/Admin/.Trash/2e4/com.apple.Safari: Directory not empty –  NathanGL Commented Jun 11, 2020 at 11:37
  • OK, this explains that: you're trying to permanently delete a file related to a preinstalled application (Safari). macOS won't allow that, not even in Recovery Mode, unless you disable System Integrity Protection first (sudo csrutil disable), reboot in normal mode, and use the commands you've already used in Terminal. Is there a reason why you tried to uninstall Safari in the first place? –  user1019780 Commented Jun 11, 2020 at 13:38
  • Thanks, @Didier turned off System Integrity Protection and can delete it now. Well, I couldn't uninstall Safari so I tried removing it totally and that happened. It simply didn't work for me. –  NathanGL Commented Jun 11, 2020 at 19:54
  • You're not supposed to uninstall Safari. It's part of macOS, same Internet Explorer is/was part of Windows. Only way to totally and cleanly uninstall it is via a third-party like AppCleaner, but it's not recommended at all. Glad you solved your problem, though. –  user1019780 Commented Jun 11, 2020 at 22:02

You must log in to answer this question.

Browse other questions tagged macos sudo rm trash ..

  • Featured on Meta
  • Upcoming sign-up experiments related to tags

Hot Network Questions

  • Meaning of 相 in 讓僑胞擁有與國內民眾相類似之教育資源
  • Maximum Power Transfer Theorem Question
  • Eye Spy: Where are the other two (of six) vehicles docked to the ISS in this Maxar image (& what are they?)
  • Audio amplifier for school project
  • The smell of wet gypsum
  • Do I need to replace \DeclareCollectionInstance after recent package change?
  • Simple Bank Management System
  • What would large scale war with tactical nukes look like?
  • River valley civilization in woodland steppe?
  • Can a creature with Mimicry activate command word magic items?
  • What is the appropriate behavior when management decisions lead to tasks no longer being done?
  • What did Jesus mean about the Temple as the Father's House in John 2:16?
  • LaTeX2e 2024-06-01 conflict with arydshln package?
  • Academic Interview Question: "What is the title of your second book?"
  • Why is MSS important? Why can't we just rely on the MTU?
  • Bringing a game console into Saudi Arabia
  • How to make a place windy
  • What was God's original plan for humanity prior to the fall?
  • How were those shrine niches originally called?
  • TCP source port sharing
  • Could a ground fault cause high power consumption? Why?
  • Memory usage of new commands requiring several intermediate commands
  • Schengen visa issued by Germany - Is a layover in Vienna okay before heading to Berlin?
  • why std::is_same<int, *(int*)>::value is false?

com.apple.safari operation not permitted

softwarehow logo

We do not use any AI writing tools. All our content is written by humans, not robots. See our editorial process .

How to Fix Terminal Operation Not Permitted Error on Mac

Avatar photo

One of the issues that you may run into when learning to use Terminal is the “Operation Not Permitted” error. Luckily, this error is pretty simple to fix. It simply means that the Terminal does not have access to whatever file you are trying to reach.

As someone who is always toying with macOS, either to fix an issue on one of my customers’ computers or to work on one of my own projects, I have seen just about every Terminal error under the sun. 

Let’s check out a few tips you can put to use if you run into the “Terminal operation not permitted” error.

Table of Contents

Key Takeaways

The causes of “terminal operation not permitted” on mac, fix #1: ensure the file you are accessing is not locked, fix #2: remove apple quarantine extended attribute, fix #3: ensure full disk access is enabled for the terminal, disable sip, final thoughts.

  • Terminal Operation Not Permitted Error on Terminal on your Mac is a relatively easy fix, and typically it is caused by one of the following possibilities.
  • The file being accessed is locked , meaning you might need to unlock it via Finder.
  • The folder has Apple Quarantine Extended Attribute , which you can easily remove via Finder.
  • If Terminal does not have Full Disk Access , you can easily check this.
  • Lastly, System Integrity Protection (SIP) might need to be disabled . But This is a temporary fix, and SIP should be reenabled as soon as possible. 

For more seasoned Mac users, the Terminal app is a very convenient way to do many things on the backend of your Mac that you wouldn’t normally be able to do on the GUI (Graphical User Interface). 

For less seasoned Mac users, it can be a bit more complicated, but if you have the right commands and understanding of the terminal, it is easy to learn. 

If you’re running into the error “Terminal operation not permitted,” it could be due to the file being locked, the file having a quarantine attribute, the terminal not having full disk access, or a system integrity problem . 

Let’s start with the easiest fixes first.

The first (and arguably easiest) problem that could be causing the Operation Not Permitted error is simply that the Terminal cannot reach the file you are trying to alter because it is locked. To check if the file is locked, we can use Finder. 

Step 1: With Finder Open, Navigate to the desired folder. Right-click (or click the trackpad with two fingers). Choose Get Info . 

com.apple.safari operation not permitted

Step 2: Verify that the Locked box is not checked and blue (like the image below), if it is, click to remove the check. 

com.apple.safari operation not permitted

Step 3: Try to run your Terminal Command again.

Sometimes, when your MacOS detects that there is a file that can be executed located in your folder, it will add a com.Apple.Quarantine attribute to the folder. This prevents the executable from running. If this is the case, then Terminal may not be able to run properly. 

Open the desired folder in Finder, if you see a folder or file with the name com.Apple.Quarantine, then move it to the trash bin.  

If Terminal does not have Full Disk Access , then it may run into problems when it has to access the file that you are trying to work with. 

Take the following steps to ensure you have full disk access.

Step 1: Open System Settings using the Apple menu. 

com.apple.safari operation not permitted

Step 2: Navigate to Privacy & Security on the left and Full Disk Access on the Right.

com.apple.safari operation not permitted

Step 3: Click to turn on Terminal.

com.apple.safari operation not permitted

Step 4: Enter your TouchID or Password to Confirm.

com.apple.safari operation not permitted

Step 5: Terminal will now show as turned on.

com.apple.safari operation not permitted

Fix #4: Temporary: Disable SIP (System Integrity Protection)

System Integrity Protection, or SIP is a very important feature on your Mac that helps to keep the entire computer safe from unauthorized programs and code. 

Because of this, this is not a recommended fix if you are not familiar with Terminal . Additionally, if you choose to move forward with this method, be sure to re-enable SIP when you are done.

  • Start your Mac in Recovery Mode (Use Command-R keys at startup)
  • Use the Utility menu to launch Terminal
  • Enter the command: csrutil disable
  • Restart your Mac normally
  • Use the Utility Menu to launch Terminal
  • Enter the command: csrutil enable

Seeing the Operation Not Permitted Error on your Mac can be quite frustrating. However, it is often an easy fix! 

One of the four fixes in this article should have helped you to solve this problem and continue to use Terminal normally. This could have been unlocking the folder that you were trying to alter in Terminal, removing the quarantine attribute, providing Terminal with Full Disk Access, or disabling SIP. 

Which fix worked for you? Were you able to solve the Terminal operation not permitted error? Let us know in the comments!

Submit a Comment Cancel reply

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

Newsroom Updates

>  Introducing Apple Intelligence for iPhone, iPad, and Mac

>  macOS Sequoia takes productivity and intelligence on Mac to new heights

Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

murrayE

ls operation not permitted on ~/Library/Safari or ~/Library/Mail

Since upgrading to macOS Safari (10.14.1), each of the commands

ls ~/Library/Safari

ls ~/Library/Mail

&mdash; even if preceded by sudo&mdash; gives error

Operation not permitted

Is there some way to get around what I presume is a security measure added in Mojave?

iMac, macOS Mojave (10.14), 4.0GHz Corei7, 32GB, 3Tb Fusion

Posted on Nov 19, 2018 7:16 AM

Posted on Nov 19, 2018 7:19 AM

I know I can get around this by going into System Preferences > Security & Privacy and giving Full Disk Access to Terminal.

But is there some less "blunt" way to do it?

Similar questions

  • Safari Security Yosemite Hello, I cannot ask administrator to change server setting just because my safari cannot open it!!! I want to sing in to the corporate outlook mail server!!! Is there a way to update safari for Yosemite that solves this issue? I can login in Catalina without any inconvenience. 163 5
  • Can't Use Safari to Email Webpages I'm running Safari 12.1.2 on a MacBook Pro, OS 10.14.6. One of the options in Safari, activated by clicking the square with the upward pointing arrow, is to "Email This Page." Somehow, this function, which used to open Mail, now opens Google Chrome. Any ideas out there for a fix? 265 2
  • I get messages that Safari in my MacBook Air is no longer supported. What should I do? I get messages that Safari in my MacBook Air is no longer supported. What should I do? 138 1

Loading page content

Page content loaded

Nov 19, 2018 7:19 AM in response to murrayE

VikingOSX

Nov 19, 2018 8:05 AM in response to murrayE

Apple has introduced more security controls in Mojave, so Terminal's Full Disk Access is the only resolution.

Can't Remove SafariFamily

I have recently removed Safari Technological Preview using AppCleaner from https://freemacsoft.net/appcleaner/ .

The issue that I am facing is that there is a residual file named "SafariFamily" (with no extension) that I can't seem to get rid of no matter what i tried.

Dragging the item into the trash would result in the error message:

"The operation can’t be completed because one or more required items can’t be found. (Error code -43)"

Placing the file in a folder, put the folder in trash and trying to empty trash would result in:

"The operation can’t be completed because the item “Folder” is in use."

Using sudo rm on the file results in:

"rm: SafariFamily: Operation not permitted"

I have also tried deleting the item from safe mode as will as using the First Aid in Disk Utility.

Any idea how I can remove it?

Not sure if you've found a fix for it yet, but I was having the same issue.

What worked for me is booting into recovery mode and disabling system integrity protection (csrutil disable) and rebooting. Then I used terminal to force empty the trash containing Safarifamily (sudo rm -R <path to file in trash>) You can just simply open the trash in finder and drag the file or parent folder into the terminal, just make sure there is a space after -R

just remember to boot back into recovery mode afterwards and re-enable system integrity protection (csrutil enable)

Thank you, this worked right away!😁

Thanks a ton. This really worked. Pesky files sitting for almost an year got removed today

I have done your direction but terminal didn't work, it wasn't except to type my password although I have been able to write (sudo rm -R and path to file safarifamily in trash)

Help me, please!

IMAGES

  1. What Is Operation Not Permitted Error On Mac How To Fix It

    com.apple.safari operation not permitted

  2. Operation not permitted error on Mac? Here's how to fix it • MacTips

    com.apple.safari operation not permitted

  3. “Operation not permitted”

    com.apple.safari operation not permitted

  4. macOS Security Bugs Exposed Safari History and Device Location to

    com.apple.safari operation not permitted

  5. “Operation not permitted”

    com.apple.safari operation not permitted

  6. “Operation not permitted”

    com.apple.safari operation not permitted

VIDEO

  1. RescueZilla: Ruhezustand verhindert Klonen der Festplatte

  2. LINUX ERROR FIX: fusermount: mount failed: Operation not permitted

  3. Scratch 3 software Error

  4. How to Fix Safari Not Working/Crashing On iPhone In iOS 17 Update

  5. Failed to setup container for group 2: Failed to set iommu for container: Operation not permitted

  6. How to Fix Safari Cannot Open the Page Because the Server Cannot be Found iOS 17 || 2023

COMMENTS

  1. The operation couldn't be completed. Oper…

    4 points. The operation couldn't be completed. Operation not permitted. Safari Downloads. I have a 2019 iMac running a dual HD setup with an SSD as the primary drive with OS installed and a HDD as the secondary. It is not a hybrid drive setup. Running Mac OX 12.6. I have my default downloads folder for Safari set to a Downloads folder on the HDD.

  2. How to get rid of "Operation not permitte…

    When I try to do point 6, the terminal says: "Operation not permitted" I have already done the granting full access to terminal but it's not working. ... the open widget lets me select files using Safari, but not using Google Chrome. Also, when I use Chrome to go to my Microsoft OneDrive Cloud where I store most of my files, Chrome Open Widget ...

  3. How do I do a find or du without getting permission denied errors

    Click on the Apple menu and choose System Settings. Choose Users & Groups. Control-click or right-click on your user account and choose Advanced Options. Enter your password when prompted and press Return or click Unlock. Click on the drop-down menu next to Login shell and choose the one you want.

  4. Operation not permitted" (NSPOSIXErrorDom…

    If the right settings are enabled in Apple's Safari browser, MACDefender can be downloaded to a system after a user clicks a link while searching the Internet. ... Operation not permitted" (NSPOSIXErrorDomain:1)" ?? I've reloaded Safari 5.0.5, reloaded Java for Mac (3Mar11 security update file with with Java 6_24), unchecked ALL Safari Java ...

  5. NSPOSIXErrorDomain:1 Safari cannot open p…

    NSPOSIXErrorDomain:1 Safari cannot open page; operation not permitted. I'm receiving this message when trying to drag a photo into google docs. I've been making cards using this method for 2 weeks and suddenly I am prevented from doing it. Any suggestions? I've cleared cache and privacy listings, etc. MacBook Pro 15″, OS X 10.10.

  6. macos

    Jun 11, 2020 at 11:37. OK, this explains that: you're trying to permanently delete a file related to a preinstalled application (Safari). macOS won't allow that, not even in Recovery Mode, unless you disable System Integrity Protection first (sudo csrutil disable), reboot in normal mode, and use the commands you've already used in Terminal.

  7. "Operation not Permitted"

    Apple's Worldwide Developers Conference to kick off June 10 at 10 a.m. PDT with Keynote address. ... it would report "Operation not Permitted" and won't let me download anything. Please provide assistance. Show more Less. MacBook Pro 13″, macOS 12.0 Posted on Jan 4, 2022 7:10 PM ...

  8. Safari Can't Open Page

    Operation not permitted" (NSPOSIXErrorDomain:1) MacBook Air running Catalina 10.15.4. Also, Google Chrome not loading. Was unable to open Norton app to "uninstall" it, tried just trashing the app. Also, Chrome installer keeps launching when I restart the computer and I'm unable to trash the installer. ... If you can't open a website in Safari ...

  9. Intermittent "Operation not permitted", "Unable to start the server

    I'm encountering an intermittent issue, while trying to run safaridriver on OSX Sonoma. Here are the details of the problem: I ran sudo /usr/bin/safaridriver -p0 --enable in the beginning. After that

  10. Safari: Operation Couldn't Be Completed. No Space Left on Device

    Ease Security Settings. Go to Safari Settings, select Websites, and scroll down to Pop-Up Windows in the left-hand pane. Allow pop-up windows when visiting websites. If this change doesn't do the trick, select Allow for all websites. Many users who had enabled the Block and Notify option confirmed that allowing pop-up windows solved the problem.

  11. Safari 5

    Safari 5 - operation not permitted on feed:// protocol. Welcome to Apple Support Community A forum where Apple customers help each other with their products. Get started with your Apple ID. ... Apple may provide or recommend responses as a possible solution based on the information provided; every potential issue may involve several factors not ...

  12. Seeing Error "Operation Not Permitted" in macOS ...

    Click the lock and enter an admin password to allow changes. Open a NEW finder window. Go to your Mac's operating hard drive (usually named Macintosh HD by default) and then click these three keys at the same time: Command + Shift + . (period symbol). This allows you to see your Mac's hidden files-select /bin.

  13. macos

    "user" can't do it either. Permission of Desktop/ is set to 700 and owned by "user". Here's the sderr output for ls -R command in the home directory:. ls: Desktop: Operation not permitted ls: AddressBook: Operation not permitted ls: CallHistoryDB: Operation not permitted ls: CallHistoryTransactions: Operation not permitted ls: com.apple.TCC: Operation not permitted ls: com.apple.sharedfilelist ...

  14. 4 Fixes for "Operation Not Permitted" Error on Terminal Mac

    Table of Contents. Key Takeaways. The Causes of "Terminal operation not permitted" on Mac. Fix #1: Ensure the File you are Accessing is not Locked. Fix #2: Remove Apple Quarantine Extended Attribute. Fix #3: Ensure Full Disk Access is Enabled for the Terminal. Fix #4: Temporary: Disable SIP (System Integrity Protection)

  15. safari

    After that when I run this multiple times /usr/bin/safaridriver -p0, I sometimes receive an "Operation not permitted" error, but not consistently. This issue seems to occur intermittently. This issue seems to occur intermittently.

  16. Intermittent "Operation not permit…

    After that when I run this multiple times /usr/bin/safaridriver -p0, I sometimes receive an "Operation not permitted" error, but not consistently. This issue seems to occur intermittently. This issue seems to occur intermittently.

  17. ls operation not permitted on ~/Library/S…

    Nov 19, 2018 8:05 AM in response to murrayE. Apple has introduced more security controls in Mojave, so Terminal's Full Disk Access is the only resolution. ls operation not permitted on ~/Library/Safari or ~/Library/Mail. .

  18. file io

    Sometimes "operation not permitted" relates to permissions, so one thing you can try to solve the problem is to go into the permissions for the folder in question. Open Finder, and get to the folder which is giving you the failed operations (such as "ls"). Right-click the folder, and select "Get Info"

  19. Webkit Content Crashing?

    Then this after starting Safari: com.apple.xpc.launchd[1] ( com.apple.WebKit.WebContent.9E4BB5E7-91F8-4112-82DB-E75387E5DF8D[1137] ): Service exited due to SIGABRT. Only installed latest macOS Beta / Security update for 10.14. Safari refuses to load any pages and the Top Sites tab shows blank pages. All pages load with "A problem was ...

  20. Safari is not able to download any files

    I tried the following things: chown the entire user folder which yielded some errors for various folders: sudo bash. chown -R thisisme:staff . Download a linked file to the "Desktop" instead. None of the things worked out. As a comparison I used Chrome, which worked so it must be something specific to Safari.

  21. Can't Remove SafariFamily

    I have recently removed Safari Technological Preview using AppCleaner from https: ... "rm: SafariFamily: Operation not permitted" I have also tried deleting the item from safe mode as will as using the First Aid in Disk Utility. ... Apple disclaims any and all liability for the acts, omissions and conduct of any third parties in connection with ...

  22. Can't git add . it shows warning: could not open the directory

    Jan 27, 2019 at 10:32. It seems you type your command in a wrong catalog. Try to type ls -ah to find .git floder, where your repo's root is. And try git add . again. If not, paste the catalog of your repo and the command you type may help us analyze.

  23. macos

    Downloads is a protected folder on macOS. When you run ls the first time, you should be shown a prompt (sample below) granting access.. If you denied this prompt, or never saw this prompt, you can change your configuration in System Settings.