@user495470's answer is correct for the question posed. The problem is neither srm
or shred
really make sense for modern systems.
This is mostly due to SSDs. Unlike magnetic disks, modern TRIM-enabled disks automatically clear deleted data in the background.
SSD's also perform wear leveling. This makes attempts to "over-write" a file both futile (you'll be writting to a different physical location) and undesirable (it needlessly contributes to disk wear).
All Macs that come with an SSDs have TRIM enabled.
The other problem the file system, specifically journaled file systems, which can keep a copy of data elsewhere before it's written out.
Even on magnetic media this can cause problems for both srm
:
All users [..] should be aware that srm will only work on file systems that overwrite blocks in place. In particular, it will NOT work on [..] the vast majority of journaled file systems.
And shred
:
[..] shred relies on a very important assumption: that the file system overwrites data in place. [..] many modern file system designs do not satisfy this assumption. Exceptions include: Log-structured or journaled file systems [..]
HFS Plus volumes are journaled by default since Mac OS X v10.3.
These days, the best way to securely "deleted" files is to enable FileVault (so they're never write disk unencrypted in the first place) then just delete them and let TRIM sort it out.
If, by stroke of misfortune, you're on a magnetic medium, have journalling disabled and, for some reason, can't encrypt the disk, you're options are:
- Use
rm -P
which overwrites files with 0xff
, then 0x00
, and then 0xff
again
- Install
coreutils
for gshred
(ie. brew install coreutils && gshred secrets.txt
)
srm
has been removed from homebrew-dupes
and homebrew-core
but someone's published a tap here that works (ie. brew install khell/homebrew-srm/srm && srm secrets.txt
)
- Physical destruction of the medium :)
Note the security of
shred
depends on the filesystem being used, I don't know how effective it is on HFS. – Flimm – 2015-07-09T09:06:12.3901shred is not effective on journaled file systems that is why it is not available. SRM also was found to not be effective. Just delete normally and pray seems to be the only hope on hfs+ journaled filesystems – Kevin Johnson – 2016-10-15T18:36:17.823
Really?! Could you please talk about why it is not effective? – inspectorG4dget – 2016-10-15T20:30:00.887
1
Journaled filesystems record the changes that will be made before the write to the disk. It can be used to recover from file corruption, or recover data you wish had been shreded. See https://en.wikipedia.org/wiki/Journaling_file_system
– Alex Mooney – 2016-11-07T18:01:00.670