Can't delete a directory in Mac
The directory is owned by root
, so you will need superuser privileges to delete it. Try,
sudo rm -rf Contents
which will ask you for your password before executing. This will also give you temporary superuser privileges for all commands at the command prompt, so be careful with subsequent commands.
In fact, if you're not used to doing this, I suggest moving the directory to trash in the first instance, until you're sure you don't need anything in the bundle:
sudo mv Contents $HOME/.Trash/
Related videos on Youtube
G.S Dash
Updated on September 18, 2022Comments
-
G.S Dash over 1 year
We have a bundle App.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//MacOS/APP: Permission denied rm: Contents//MacOS: Directory not empty rm: Contents//Resources/App.rsrc: Permission denied rm: Contents//Resources: Directory not empty rm: Contents/: Permission denied
lsof shows that there are no processes that are using this bundle and running stat Contents/Resources/App.rsrc outputs:
234881026 3691189 -rw-r--r-- 1 root wheel 0 733 "Mar 18 16:10:13 2012" "Mar 8 17:00:18 2012" "Mar 18 15:04:39 2012" "Mar 8 17:00:18 2012" 4096 8 0 Contents/Resources/App.rsrc
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
-
G.S Dash about 12 yearsWe can't use sudo since this is done as part of an automatic-updates process
-
CoffeeRain about 12 years@kambi It's owned by root, so you can't delete it without either being root or being an admin and using sudo.