​​ ​

The Apple Support Community will permanently close on November 20, 2026. Starting today, the site will no longer accept new posts and is available in a read-only state.


You can continue to find trusted guidance and support on the official Apple Support site. 


We want to thank the community members who have contributed their time and expertise to help others with their Apple products.


Formatting external HDD with Terminal on MacBook Pro

I want to format an external HDD with terminal What instructions would I use?




[Re-Titled by Moderator]

Posted on Dec 20, 2024 11:12 AM

Question marked as Top-ranking reply

Posted on Dec 20, 2024 11:34 AM

  1. Enter diskutil list to check all the connected drives. Find the one where external is written and note the path which will be like /dev/diskX
  2. Enter diskutil unmountDisk /dev/diskX to unmount the drive 
  3. Enter diskutil eraseDisk APFS MyDrive /dev/diskX to format the drive. Replace APFS with the preferred format and MyDrive with the name you want.
  4. For Format of the drive you can use APFS (Mac only), ExFAT (For Both Windows and Mac), NTFS (Windows only) etc..
2 replies
Question marked as Top-ranking reply

Dec 20, 2024 11:34 AM in response to PhotoEditor

  1. Enter diskutil list to check all the connected drives. Find the one where external is written and note the path which will be like /dev/diskX
  2. Enter diskutil unmountDisk /dev/diskX to unmount the drive 
  3. Enter diskutil eraseDisk APFS MyDrive /dev/diskX to format the drive. Replace APFS with the preferred format and MyDrive with the name you want.
  4. For Format of the drive you can use APFS (Mac only), ExFAT (For Both Windows and Mac), NTFS (Windows only) etc..

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

Formatting external HDD with Terminal on MacBook Pro

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.