Be careful not to delete any system files. If you don't know the source of the file, don't delete it, as that may cause damage to the operating system!
Follow any of these five sets of methods very carefully and do not press any keys until told to do so:
Five methods: Booting into Mac OS 9, Repair permissions (step 8 of the first method only) and restart computer from Apple menu, Replacing the file, using sudo, Cocktail
Booting into Mac OS 9
This method is only recommended if you are using Mac OS X 10.1.5 or higher.
To boot into Mac OS 9 which you can if your machine is not listed on Article 86209 and you have a working Classic System Folder (Follow Article 106294 if your machine is not listed in Article 86209 , does not have a valid Mac OS 9 System Folder, and has no Mac OS 9 bootable installer CD that can boot it).
1. Select Apple menu -> System Preferences -> Startup Disk
2. Select the System folder with Mac OS 9 and hit the Restart button.
3. When in 9, remember the Desktop folder is found under
Hard drive -> Users -> yourname -> Desktop
your home folder is the Hard drive -> users -> yourname
That should help you find the file that you couldn't delete.
4. Go there to drag the file to the trash, and empty the trash from the Special menu.
5. Restart the computer from the Special menu and hold down the X key as soon as you let go of the mouse button on the Restart menu option. The file will disappear after the restart.
6. Go to Applications -> Utilities -> Disk Utility -> First Aid tab, select hard drive, and then select Repair Permissions. Note if you are using 10.1.5 you will need to download the Repair Privileges Utility and run it instead of going to Disk Utility to repair permissions.
Replacing the file (Ryan Becker's method)
Replace the file on the desktop, and you can then delete it. To do this, find a file elsewhere on your HD that is the same type as the file you want to delete (such as jpg, dmg, mp3, sit, bin, etc, etc). Duplicate that file in the folder where it is right now. Now, name the new copy the EXACT same name as the file on your desktop. Drag the file to the desktop, and click YES when it asks it you want to replace the existing file. Once replaced, you should be able to delete the file!
The final method is Using Sudo:
1. Open Applications -> Utilities -> Terminal
2. Type the following in Terminal but don't do anything else until instructed to below (no return keys, nothing!)
sudo rm -i
3. Insert a SINGLE space after the -i
4. drag the offending file over the Terminal window.
5. make sure with the left right arrow keys there is only ONE space between -i and the /hard drive name...filename
6. and hit the Return key.
7. You will be prompted for your password which you use to install system software and you enter it followed by the return key.
8. You will be prompted hopefully for only the file you wanted to delete, and if that's the file, type Y for yes. If it isn't, type N for no. You can always hit Control (CTRL) key simultaneously with the C key to cancel the operation.
Once back at the prompt type:
followed by the Return key.
9. Select Quit from the Terminal menu.
The file will not necessarily immediately disappear. But it should after opening another Finder window.
Or use Cocktail Within its Files section -> Locked tab is a delete files function