More recently, I have been using rm -r /path/to/file to delete files, but when deleting from certain locations, I get the error: override rw-r--r-- root/admin for filename? I have tried entering y, but I get the error: rm: filename: Permission denied. I have also tried rm -rf and yes | rm -r with the error rm: filename: Permission denied again. Is there any way to bypass this strange issue? My operating system is Mac OSX Yosemite, and I am using Terminal.

  • It probably has to do with the permissions on the directory not the file. – mdpc Jul 19 '16 at 22:47
  • I believe that is true @mdpc, I am asking how to override that I guess. I probably should have made that more clear. – ALX Jul 19 '16 at 22:48
  • A solution would be to change the directory permission. – mdpc Jul 19 '16 at 22:48
  • 1
    What are the permissions on /path/to, does chflags show anything interesting on any of the files or directories involved, and you might need to boot in rescue mode to delete some of the really restricted files in recent OS X releases. – thrig Jul 19 '16 at 22:49
  • And that is with the shift key, correct? – ALX Jul 19 '16 at 22:50

It seems that your file was created using superuser sudo (root/admin) attributes so, in order to modify o delete this file you would need to authenticate as a sudo, to do this simply type:

sudo rm -rf path/to/file

here rm -rf stands as remove recursively so that if path/to/file is a folder all its content will be removed. Your machine will ask you for sudo password. Consider that after this instruction the files will be completely removed!.

| improve this answer | |
  • I thought sudo is deprecated on mac, but it worked! – zyy Dec 20 '19 at 15:11

You could try to delete the folder with sudo.

sudo rm -rf foldername
| improve this answer | |

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.