Securely Deleting with Mac OS
June 12th 2011In preparation of giving my laptop away, I recently found myself needing to securely wipe files and disks from Mac OS ( and from the Mac OS installation disk environment ). Here is what I found
Apple Includes Some Fantastic Utilities
Srm
Srm allows you to securely erase individual files and folders with a variety of proven methods. These options include DoD compliant 3 and 7 pass erasures.
DiskUtil
Similar to it's GUI brother, the command line Disk Utility provides ways to (un)mount, format and partition your storage devices. Unlike it's sibling, the command line utility also lets you specify the number of random write passes, and enables you to securely wipe multiple disks simultaneously.
For example:
# Wipe randomly 3 times
diskutil randomDisk 3 /dev/disknumber
# Background diskutil wipe
diskutil secureErase 4 /dev/disk1 &
diskutil secureErase 4 /dev/disk2 &
Since it's in the shell, we can use shell constructs to queue and ( for the truly paranoid ) loop our wipe jobs.
For example:
# Wipe one after the other
diskutil secureErase 4 /dev/disk1 && diskutil secureErase 4 /dev/disk2
# Loop a disk wipe
while(true); do diskutil secureErase 4 /dev/disknumber; done