Deleting unwanted files, documents, photos, music and other items from your Mac's hard drive is easy - but there are a few exceptions or more challenging situations. In this tutorial we explain how to delete your trash completely and securely, in Mac OS X.

How to delete all trash on a Mac: The basics

To delete a file from your Mac, drag its icon on to the Trash icon, located at the far right of the Dock bar (which by default sits along the bottom of your screen, but can be moved elsewhere).

How to completely delete all trash on Mac

'Trashed' items haven't been deleted yet - they sit in the bin waiting to be deleted or recycled.

To get something back out of the trash, left-click the bin icon, and a folder will appear containing all your binned files. You'll need to pull a file out of the bin to be able to double-click it and open it up; otherwise Mac OS X will say "The document ______ can't be opened because it's in the Trash. To use this item, first drag it out of the Trash." You can preview items in the Trash, though.

To delete everything in the Trash, right-click the bin icon and select 'Empty Trash', or in Finder, click the Finder drop-down menu, then 'Empty Trash'.

How to delete all trash on a Mac: Secure deletion

The simple process above is fine if you just want to free up space on your Mac, but the files 'deleted' aren’t really deleted at all; they're just 'targeted for termination', if you like. Mac OS X removes the tags that enable these files to be located conventionally, and then writes over them when the space is needed.

With the right data-recovery tools, however, and enough luck and/or speed that they haven't been overwritten yet, these files can be saved. Which is a great relief is you delete something important by mistake, but what if the files are personal, confidential or business-critical, and someone else - a business rival, a burglar, a hacker - gets access to your Mac?

To make it harder to recover deleted files, you can use a process called secure deletion. It's as simple to use as selecting 'Secure Empty Trash' from the Finder dropdown menu, instead of just 'Empty Trash'.

How to completely delete all trash on Mac

Alternatively you can use Secure Deletion by right-clicking the bin itself and holding down Apple (the 'Cmd' button) - the option will change to Securely Empty Trash.

How to completely delete all trash on Mac

Secure Deletion writes over deleted files with nonsense data so they can’t be recovered - not easily, at any rate. Forensic data recovery firms can perform miracles sometimes. Needless to say, make sure you only use this process if you're absolutely sure that you want the files deleted.

But on the other hand, we'd advise against selling a Mac with a hard drive that has contained secret governmental files, even if they've been securely deleted. Just to be on the safe side.

How to delete all trash on a Mac: Erase Free Space

Another approach you can use to be doubly sure that deleted files are really gone is to use Erase Free Space to write over any files marked for deletion. This is a function of Disk Utility, which can be found in Mac OS X under Applications > Utilities.

First, you need to select the hard drive you want to use. Under the Erase tab, select Erase Free Space. You'll get various options, which vary depending on how thoroughly you want to wipe the files, and how quickly you want to work. In Mavericks you can write over the files once, three times or seven times.

How to completely delete all trash on Mac

How to delete all trash on a Mac: The Trash won’t empty!

Emptying the Trash isn't always as simple as selecting 'Empty Trash' or 'Secure Empty Trash', unfortunately; there may be files that are locked, or that you haven't got permission to delete.

If you're getting error messages saying the Trash won't empty, one option is Force-Empty. Hold Alt (also known as Option) while selecting the commands mentioned before, and Mac OS X will override barriers to deletion where possible.

How to delete all trash on a Mac: Deleting locked files

Still can’t delete everything? Check problem files to see if they're locked, and, well, unlock them. (Locked files should be deleted if you use Force-Empty, but it’s worth double-checking if there are only a few outstanding files.)

Right-click the file and select 'Get Info'. Under General, untick Locked.

How to completely delete all trash on Mac

How to delete all trash on a Mac: Deleting files with incorrect permission settings

You should also check the permissions - if you haven’t got write permission for a folder, you won't be able to delete it, or any files contained within it.

Apple's own support pages have more on this topic. 

How to delete all trash on a Mac: Special characters

The last thing to consider is the name of the file you can't delete - could special characters be causing an issue?

The file or folder name should not contain any special character such as a copyright symbol, slash, bullet point or similar. Ordinarily this wouldn't be a problem, but occasionally it prevents a file being deleted, so it's worth changing the file name to something simpler. Now try deleting it.

How to delete all trash on a Mac: Individual users

A final word: in Mac OS X, there are individual Trash folders for each user, so deleting the contents of your Trash won't affect the contents of theirs. If you want to free up as much space as possible, you'll need to log into each user's account and delete the Trash there.