3

I recently encountered an error where none of the applications would open, similar to this. I was able to resolve the issue by using Go to Folder... option under the Go menu and navigating to /var/folders/. I deleted all the folders there and rebooted my system, after which everything is working normally.

The problem now that I'm unable to permanently delete the folders fz and sv from Trash. When I try to delete them, I get the following warning and no matter what I select, the folders are not deleted from Trash - The operation can’t be completed because the item “0” is in use.

Note - MacOS has already replaced these deleted folders in /var/folders/.

I've also tried deleting it from the terminal with super user permissions but still can't delete them -

Anish@Anishs-MBP:.Trash $ sudo rm -rf *
Password:
rm: fz/w4_v47p50v141vqr9pwtg9qc0000gp/0/SafariFamily: Operation not permitted
rm: fz/w4_v47p50v141vqr9pwtg9qc0000gp/0/com.apple.LaunchServices.dv: Operation not permitted
rm: fz/w4_v47p50v141vqr9pwtg9qc0000gp/0/com.apple.nsurlsessiond: Operation not permitted
rm: fz/w4_v47p50v141vqr9pwtg9qc0000gp/0/com.apple.routined: Operation not permitted
rm: fz/w4_v47p50v141vqr9pwtg9qc0000gp/0: Directory not empty
rm: fz/w4_v47p50v141vqr9pwtg9qc0000gp: Directory not empty
rm: fz: Directory not empty
rm: sv/tjz3fg0j3hx5_lhhmv335s0m0000gn/0/com.apple.LaunchServices.dv: Operation not permitted
rm: sv/tjz3fg0j3hx5_lhhmv335s0m0000gn/0/com.apple.nsurlsessiond: Operation not permitted
rm: sv/tjz3fg0j3hx5_lhhmv335s0m0000gn/0/com.apple.routined: Operation not permitted
rm: sv/tjz3fg0j3hx5_lhhmv335s0m0000gn/0: Directory not empty
rm: sv/tjz3fg0j3hx5_lhhmv335s0m0000gn: Directory not empty
rm: sv: Directory not empty

I've also rebooted the system in Safe Mode and tried to delete them but no luck.

I realize that there are operations being run tied with these files that's causing the problem. How do I find and stop these tasks so that I can delete these folders?

This issue is only with a single user account. It looks like I'll have to disable System Integrity Protection and then try to delete them. Is that safe? I'm using High Sierra if that matters.

Any help would be greatly appreciated.

2 Answers 2

2

If you can’t delete the file because a process is holding it open you could try killing the process and then deleting the file. To find the process try the command below

lsof | grep [path_to_file]

Then kill each process by ID with

kill -9 [id]

For lsof to give you the PIDs the file must be open when lsof is actually executing. If it’s being opened and closed extremely quickly by one or more processes then this approach may not work

There’s another way that’s more OSX friendly/specific which is the following command

sudo fs_usage | grep [path_to_file]
2

Killing the processes did not work for me. They kept respawning making it impossible to delete them.

The only way I could empty Trash, as briefly mentioned in the question, was to temporarily disable System Integrity protection (SIP).

If anyone else faces the same problem, these are the steps -

  1. You can disable SIP by following the numbered steps listed in this answer.
  2. After restarting your Mac, try opening Trash in Finder and clicking on Empty, which should hopefully delete the all of its contents.

Important: Do not forget to enable SIP after emptying Trash -

  1. Reboot your Mac in Recovery Mode and open Terminal, same as you did in Step 1 above.
  2. In the Terminal window, type in csrutil enable and press Enter.

  3. Restart your Mac.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .