There is a folder in /tmp/ that won't delete despite my computer being restarted. I know it's not being recreated at restart since the last edited and added date is 23 November 2015. I do know which program it belongs to, but I have uninstalled every last part of it. sudo rm -rf and sudo mv gives me operation not permitted, as well as directory not empty. I have had this before but my solution was moving them to /tmp/. The permissions are 0755 and I am not allowed to change them, including in sudo.

It's also not a big deal if they are not deleted, since take up 0 K space, but I just thought it was weird.

Moving them to /private/var/folders/f8/*/Cleanup At Startup did not delete the files either.

  • Are they locked files? /private/var smells like OS X and el capitan adds System Integrity Protection (SIP) that could make for undeletable files. I think there's flags on ls to show these flags, but my Mac is at home. – thrig Dec 4 '15 at 18:28
  • @thrig, when I think about it they are very likely files protected by SIP, however I can't turn SIP off because my recovery partition is broken. – DisplayName Dec 4 '15 at 18:40
  • Take a look at the output of # lsattr -d /tmp/FOLDER. If flag i is set (inmutable), then disable if #chattr -i /tmp/FOLDER – albertovar Dec 5 '15 at 9:21

They are files protected by SIP, which can be turned off by booting into the Recovery Partition and running csrutil disable.

| improve this answer | |

lsof will tell you what program has files open in that directory. End the process and then rm -rf the directory. If there aren't any open files in that directory then it's possible you have some filesystem corruption. Since /tmp is probably part of your root filesystem you'll need to force fsck at the next reboot. Use sudo shutdown -rF now to do that (the -F flag forces fsck on reboot). After the fsck is done try rm -rfing the files again.

| improve this answer | |
  • Hm.. weird, /tmp isn't even mentioned in lsof. – DisplayName Dec 4 '15 at 17:55
  • I guess the bigger question is what is the problem with the directory staying there? Does it just bug you or is it causing problems? – David King Dec 4 '15 at 17:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.