Mac OS X can experience difficulty deleting certain files due to the following (and other) reasons:
- The file is in use by an application or system process
- The file is locked
- The user does not have permission to delete the file
- The file is damaged or otherwise corrupt and "cannot be found" by the system
- Quit any and all applications you think might be using the file
- Open Activity Monitor (located in /Applications/Utilities) and kill any processes you think might be using the file (for more on killing processes with Activity Monitor, see this article)
You can also restart, which may put an end to lingering processes that are unnecessarily making use of files you are attempting to delete.
B., C., D. (file is locked, user does not have permission, file is damaged) Select the file in the Finder and press the Command and I keys simultaneously (or select "Get Info" from the File menu). Try to deselect the box next to "Locked." If the box is grayed out and you cannot change the locked status, you do not have permission to modify the file. In this case, try one of the following:
Use Secure Empty Trash The simplest workaround and the first one you should try is to drag the problematic file to the Trash, then (while in the Finder) select "Secure Empty Trash" from the "File" menu.
- Select the file in the Finder. Hold down the option key, then go to the "File" menu and select "Show Inspector" (this item replaces "Get Info" when the option key is held)
- Go to the "Ownership and Permissions" section, then click the "Details" disclosure arrow.
- Click the small lock icon next to the "owner" menu, and enter your administrator password.
- Change ownership to your administrator account.
- From the "You can:" menu, select "Read and write"
- You should now be able to uncheck the "Locked" box and delete the file
Change lock flag via Terminal You can also manually unlock files via the Terminal with the following command:
- chflags nouchg nameoffile
After which you can attempt deletion from the Trash, or use the Terminal delete command listed below.
Delete via the Terminal Failing the above, use the following command in Terminal (located in ~/Applications/Utilities)
- sudo rm -R
followed by the location of the file you are trying to delete, e.g.:
- sudo rm -R "/Applications/Photoshop CS2/legal/Tieng Viet.html"
Use Force Delete Finally, there is a freeware application dubbed Force Delete that can sometimes delete persistently locked and otherwise stubborn files.
The aforementioned workarounds can also be useful in a situation where Mac OS X says that the file marked for deletion "cannot be found," or generates a numbered error.
Like what you've found in this tutorial? Get more troubleshooting guidance (updated daily) by subscribing to MacFixIt Pro.