How to format a hard drive on macOS

Whether your troubleshooting an old hard drive or preparing an SD card for a Raspberry Pi—you'll probably need to format that. We've got you covered! Today we're looking at the best ways to format a hard drive on macOS.

These processes will work for hard drives, external drives, and flash drives alike. First things first, make sure the drive you want to format is connected to your computer.

Type diskutil list and press enter. This will provide a list of hard drives attached to the machine. Locate and note the name of the drive you want to format.

You can use the diskutil eraseDisk command to format a harddrive. Run the following command, be sure to make adjustments for your drive. Replace JHFS+ with any file system you need (check the chart above for a list of file systems you can use). Replace CleanDrive with the new name for your formatted drive. Put your disk name in place of /dev/disk1