Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can't delete a directory in Mac

We have a bundle myapp.component and inside it we have a 'Contents' directory with the following permissions:

drwxrwxrwx  4 root  wheel  136 Mar 18 15:05 Contents

When I try to delete this directory using

rm -rf Contents

It fails with the reason

rm: Contents/Resources/myapp.rsrc: Permission denied
rm: Contents/Resources: Directory not empty

We do have permissions to delete the 'Contents' directory so why does it still fails?

Edit: If I move the bundle from /Library/Audio/Plug-Ins/Component to ~/tmp/ then It will delete the folder without any problems

Thank you

like image 388
kambi Avatar asked Mar 18 '12 13:03

kambi


2 Answers

You have permission to delete Contents, but not Contents/Resources/mypp.rsrc. If you do ls -l on that you'll see some more restrictive permissions.

In any case, from an admin account, you can do:

sudo rm -rf Contents

and it should work fine.

like image 109
James Aylett Avatar answered Oct 19 '22 04:10

James Aylett


The file is probably still open.

You can use the lsof command to list open files, and find out what's using them:

lsof | grep "myapp\.rsrc"

Will probably tell you about the program with that particular file open.

like image 28
James Avatar answered Oct 19 '22 05:10

James