You can make a difference in the Apple Support Community!

When you sign up with your Apple Account, you can provide valuable feedback to other community members by upvoting helpful replies and User Tips.

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

Can't delete a file in the trash

I downloaded a "High Sierra" installer to create a Parallels VM on my MacBook Pro running the latest Monterey.


And now I can't remove the installer file "Install macOS High Sierra" from the trash. I get The operation can't be completed because the item "Install macOS High Sierra is in use".


Here's what I've tried, none of which have worked:

  • Right-click, "Delete immediately."
  • GetInfo and unlock the panel with my admin password
    • Set permissions on the file to give my account read/write access
    • The "Locked" checkbox is greyed out, but unchecked even with unlocking the panel with my root password
  • Terminal mode
$ sudo rm -rf /Users/sparker/.Trash/Install\ macOS\ High\ Sierra.app
Password:
rm: /Users/sparker/.Trash/Install macOS High Sierra.app/Contents/SharedSupport/InstallESD.dmg: Operation not permitted
rm: /Users/sparker/.Trash/Install macOS High Sierra.app/Contents/SharedSupport: Directory not empty
rm: /Users/sparker/.Trash/Install macOS High Sierra.app/Contents: Directory not empty
rm: /Users/sparker/.Trash/Install macOS High Sierra.app: Directory not empty
$ sudo lsof /Users/sparker/.Trash/Install\ macOS\ High\ Sierra.app
$
  • Move the file from trash, and try the `sudo rm -rf ...` from the Desktop
  • Reboot in safe mode, and try all the things above


Any idea how to get rid of this file? I'm surprised that I can't do it with `sudo`, but I know that apple bastardized the meaning of `sudo` in recent OS releases...

Parallels, macOS 12.0

Posted on Feb 20, 2022 9:02 AM

Reply
Question marked as Top-ranking reply

Posted on Feb 20, 2022 9:37 AM



Disable SIP via recovery mode csrutil and then remove the file in question and then Enable SIP again as soon as done.



Disable System Integrity Protection Temporarily


To disable SIP, do the following:


  1. Restart your computer in Recovery mode.
  2. Launch Terminal from the Utilities menu.
  3. Run the command csrutil disable.
  4. Restart your computer.


Warning


Disable SIP only temporarily to perform necessary tasks, and reenable it as soon as possible. Failure to reenable SIP when you are done testing leaves your computer vulnerable to malicious code.


Enable System Integrity Protection


To reenable SIP, do the following:


  1. Restart your computer in Recovery mode.
  2. Launch Terminal from the Utilities menu.
  3. Run the command csrutil enable.
  4. Restart your computer.



Similar questions

3 replies
Question marked as Top-ranking reply

Feb 20, 2022 9:37 AM in response to parkerpress



Disable SIP via recovery mode csrutil and then remove the file in question and then Enable SIP again as soon as done.



Disable System Integrity Protection Temporarily


To disable SIP, do the following:


  1. Restart your computer in Recovery mode.
  2. Launch Terminal from the Utilities menu.
  3. Run the command csrutil disable.
  4. Restart your computer.


Warning


Disable SIP only temporarily to perform necessary tasks, and reenable it as soon as possible. Failure to reenable SIP when you are done testing leaves your computer vulnerable to malicious code.


Enable System Integrity Protection


To reenable SIP, do the following:


  1. Restart your computer in Recovery mode.
  2. Launch Terminal from the Utilities menu.
  3. Run the command csrutil enable.
  4. Restart your computer.



Can't delete a file in the trash

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.