When you drag files or folders to the Trash icon in the Dock, OS X doesn't delete them immediately. Just as you can pull something out of a physical trash can before the garbage collector arrives, you can remove files from the Trash until you decide you want to get rid of them for good (and thereby recover the disk space the files were using). When that time comes, you choose Finder > Empty Trash.

Ordinarily, emptying the Trash is immediate and uncomplicated. But occasionally something goes wrong and your Trash won't empty; the Finder may display an error message indicating a reason (though not how to fix the problem). If that happens to you, here are several solutions you can try.

'The file is in use'

If the error message claims that a file is in use, quit the last app that accessed that file (if you know what it is). Then, try to empty the Trash again. Sometimes this error is spurious--for example, Mail may report that a file is in use long after you sent it as an attachment. Even though the file isn't truly in use, Mail might treat it as if it were. Quitting Mail, emptying the Trash, and reopening Mail usually solves the problem.

'The file is locked'

If the error message tells you that a file is locked, hold down Option and again choose Finder > Empty Trash; the Option key tells OS X to override locked files.

How to force it with apps

Those tricks won't work if the error message says that you don't have permission to delete a file, or if no error message appears at all but the Trash remains full. In these cases, you have a couple of approaches to take.

You might already have a utility that, among many other features, can force-empty the Trash--for example, Maintain's $19 Cocktail and Titanium's Software's OnyX (free, donations requested) offer this feature.

Or, if you want a small utility that does nothing but force the Trash to empty, try NoName ScriptWare's Trash It (free, donations requested).

DIY Terminal tricks

However, all those utilities merely send OS X commands that you can issue yourself in Terminal. To do so, first open Terminal (in /Applications/Utilities). Type cd ~/.Trash and press Return. Then, type sudo rm -R followed by a space (don't leave out the space character--it's essential). Don't press Return yet.

Next, click the Trash icon in your Dock to open a window displaying the contents of the Trash. Select everything in that window and drag it into the Terminal window; this action adds the paths of all those files and folders to the rm (remove) command. Now, press Return and enter your administrator password when prompted. In a moment or two (depending on how much was in your Trash), the Trash icon should return to its empty state.

See also:

Study finds 57% of iPhone users don't browse past top 25 apps

Dispatch estimates for 21.5in iMac slip as 27in model delays continue

Google looks to kill passwords, but experts say not so fast

35 Emergency Fixes for iPad and iPhone disasters