How do I format a disk partition from the command line on Mac OS X?
In case someone wonders why: because for some people Disk Utility fails.
Ask Different is a question and answer site for power users of Apple hardware and software. It only takes a minute to sign up.Sign up to join this community
For those of you looking to format an entire disk and remove all partitions here is the command:
diskutil eraseDisk free itsfree /dev/disk6
Even though I am formatting with free space-- I still had to give it a name for the command to work, in this case itsfree.
To list your disks
To securely erase - Needs to have a mounted volume
diskutil secureerase freespace 0 /dev/disk6s2
To list available filesystems