Advanced tip about deleting locked files
If there are several locked files in the Trash, you can unlock them all at the same time at the command line. Follow these steps:
- Open Terminal. It’s located in /Applications/Utilities.
Type: sudo chflags -R nouchg
Note: Type one space (not pictured) after nouchg in the line above, so that it ends in "nouchg ". Do not press Return yet.
- Double-click the Trash icon in the Dock to reveal the contents of the Trash. If necessary, arrange the Finder window so that a portion of the Terminal window is still visible.
- Press the Command-A key combination to select all files in the Trash.
- Drag the files from the Trash to the Terminal window.
Note: This automatically enters the pathname for each file. This eliminates the need to individually empty multiple Trash directories, particularly when multiple disks or volumes are present.
- Press Return. No special text message will be shown indicating that the command was successful.
- Empty the Trash.
If the Trash does not empty or if you see a message in Terminal that says “usage: chflags [-R [-H | -L | -P]] flags file…” you most likely did not type the text in step 2 as indicated or did not leave a space. Repeat the steps if this happens.