Nuke a Disk on OS X

For security reasons, or in case you want to sell your hard drive, formatting the disk is not enough. The reason lies in the formatting process itself: formatting only resets the content list of a drive. Your data is still written on the disk, as long as you do not overwrite them.

There are different apps providing different overwriting strategies. The following simple comand overwrites a disk once with a random sequence of 0s and 1s:

cat /dev/random > /dev/disk[X]

X is here the index of the disk you want to overwrite. With

diskutil list

you can list all your partitions.