diskutil secureErase
macOS ships a multi-pass overwrite, and its own manual tells you not to trust it.
What it does
diskutil secureErase overwrites a whole disk, or just the free space on a mounted volume, with a choice of patterns:
diskutil list # identify the disk, carefully
diskutil secureErase 1 /dev/disk4 # single-pass random fill
diskutil secureErase freespace 0 /Volumes/ArchiveLevels are 0 zero fill, 1 random fill, 2 seven passes, 3 the 35-pass Gutmann algorithm, 4 three passes. Levels 2 to 4 take an extremely long time and buy nothing on any drive made this century.
diskutil list immediately beforehand — identifiers move when you plug something in.Notes
Apple’s own manual page is blunt about the limits, and it is worth quoting rather than paraphrasing:
This kind of secure erase is no longer considered safe. Modern devices have wear-leveling, block-sparing, and possibly-persistent cache hardware, which cannot be completely erased by these commands. The modern solution for quickly and securely erasing your data is encryption.
So:
- Internal storage on an Apple Silicon Mac is already encrypted by the Secure Enclave. System Settings → General → Transfer or Reset → Erase All Content and Settings discards the keys, which is instant and complete. That is the supported way to retire a Mac.
- An external SSD is best encrypted from the day you start using it — then erasing the volume ends the story. Failing that, the drive’s own firmware sanitise command is the only thing that reaches spare blocks; see Parted Magic.
- A mechanical disk has no wear levelling worth worrying about, and a single overwrite pass really is enough. This command is fine for those.
Alternative to
| Alternative | Type | Trade-off |
|---|---|---|
| Erase All Content and Settings | Built in | Instant and complete, but only for the Mac’s own internal disk |
| ShredOS | Open source | Boots from a stick, wipes disks the running system is using, logs the result |
| Parted Magic | Paid | Issues the drive’s firmware sanitise command instead of overwriting it |
| dcfldd | Open source | Scriptable patterns and a hash of what was written |
shred from coreutils | Open source | Per-file rather than per-disk, and just as defeated by wear levelling |
Install
Nothing to install — diskutil ships with macOS. The full documentation is in the manual page:
man diskutil