How to "Secure Empty Trash..." (wipe free space) on OS X El Capitan?

Solution 1:

The secure delete option was removed from El Capitan, but as explained in this article, there may be some alternatives you may wish to use (see below for notes if the Mac has an SSD).

  1. You can use the disk utility to overwrite the free space on the drive;

    diskutil secureErase freespace LEVEL /Volumes/DRIVENAME
    

    Where;

    In this command, change LEVEL to a number of 0 through 4, where 0 is a single-pass of zeros, 1 is a single-pass of random numbers, 2 is a 7-pass erase, 3 is a 35-pass erase, and 4 is a 3-pass erase (note all non single-pass options may take a while to complete).

    You can consult the man page for more detail on the command usage.

  2. Overwrite the contents before the deletion (from the terminal);

    rm -rP /path/to/file-or-folder
    

    Where r is to recurse over the folders and P will overwrite their contents.

  3. The srm utility provides a mechanism (from at least Yosemite) to overwrite and remove files, lifehacker has an article on its use;

    srm -v ~/Path/To/file.remove
    

    The -v indicates verbose mode.

  4. Consider using the "Delete Immediately" option that was added to El Capitan. Whilst this may not be the "secure delete" you are looking for, it does skip the trash.

It is important to bear in mind that with modern SSD wear levelling, writing to the same location in a file isn't necessarily going to write to the same location on the disk, hence the secure deletion would not always achieve what you wanted (see CVE-2015-5901 and hence removed in El Capitan). Given an SSD, the "erase"-ing of the free space is probably the best option, once the files have been deleted and removed from the trash.

For those with mechanical disks (non-SSD), the srm option may be the easiest alternative.

Solution 2:

The reason for removing this option has been explained here by Apple:

An issue existed in guaranteeing secure deletion of Trash files on some systems, such as those with flash storage. This issue was addressed by removing the "Secure Empty Trash" option.

So while it might seem annoying that this option is gone, bringing it back via some kind of Terminal wizardry is not going to make it safe/reliable.

If you have sensitive material, I'd suggest not storing it unencrypted in the first place, so that deleting it in the "normal" way becomes a non-issue.