I’ve recently ran a semi-routine clean install on my 2018 MacBook Pro. This involves the following steps (in the given order):

  • Creating a USB installer with the latest macOS Mojave 10.14.2.

  • Booting into the USB (Pressing Option key on boot).

  • Using the Disk Utility, erasing the Disk and formatting it as APFS with a GPT Partition scheme.

  • Using the Terminal, unmounting the disk diskutil unmountDisk disk0, where disk0 is the internal NVME drive.

  • Using the Terminal, running gpt destroy disk0 where disk0.

  • Using the Terminal, running diskutil zeroDisk disk0.

  • Once that process is complete, I use the Disk Utility application to reformat as APFS, and install macOS.

Nothing super crazy, maybe a little redundant in steps, maybe a little overkill, maybe a little unnecessary.

Recently, however, on the final step where I format it as a APFS drive, it fails in creating the APFS container and says Internal State Error. It appears to first format as Mac OS Extended (Journaled) then create an APFS container, then add a APFS Volume. It fails when adding a Volume with An internal error occurred.

I have tried many things, including:

  • Securely erasing the drive diskutil secureErase 0 disk0.

  • Simply zeroing the disk again diskutil zeroDisk disk0 (I’m not sure what the actual difference between these two are).

  • Reformatting the drive as other things, such as ExFAT / FAT / MacOS Journaled, then trying to format as APFS.

  • Reformatting the drive through the command line instead: diskutil eraseDisk JHFS+ NAME disk0diskutil apfs createContainer /dev/disk0s2diskutil apfs addVolume disk0s2 APFS NAME (It fails here with Error starting APFS Container creation: The given disk is not an APFS Container Reference (-69630), even though I just made a container there. Also, trying to add a volume to where it actually made the container (i don't know what it does this) diskutil apfs addVolume disk24 APFS NAME also fails with Error: -69624: Unable to add a new APFS Volume to an APFS Container

  • Reformatting the drive using this: diskutil eraseDisk APFS NAME disk0

  • Restarting and trying these again.

  • Using a different installer than the USB (The one from Command + R, Command + Shift + R, and whatever the other combo is), and trying these again.

All end up at the same thing - the final step fails. I would expect especially after a secure wipe that the drive would be removed from whatever state it was put in, or that if it was a bug with the 10.14.2 installer, that it still wouldn’t happen again in the High Sierra installer. In Disk Utility, I’m left with the following structure:

- APPLE SSD AP(...) // “Container disk24” takes up all space 

   - Container disk24 // or some other number. “Used” is 207.2MB and “Free” is 1TB.

Please note even though I can format as JHFS+, it won’t let me install the OS to such a formatted volume. The installer tells me this computer forces me to only install on APFS formatted volumes.

Any direction is greatly appreciated. I have never had such a silly problem before. Also, note that I have no Time Machine backup.

  • The most straight forward approach is the command diskutil partitiondisk disk0 1 gpt apfs "My Mac" 0 Dec 27, 2018 at 16:44
  • @DavidAnderson I have tried this after a disk cleanup and unfortunately I get the following: newfs_apfs: unable to format volume inside /dev/disk0s2: No space left on device, Could not mount disk0s2 after erase, and finally, Error: -69832: File system for matter failed.
    – yadon
    Dec 27, 2018 at 17:33
  • have you resolved this issue? Aug 6, 2019 at 18:20

2 Answers 2


Below are three examples of how to erase the drive and create a APFS volume named MyVolume. You only need to follow one of the examples.

  • The commands given below create a Mac OS Extended (Journaled) partition, then reformat to APFS.

    diskutil eraseDisk JHFS+ dummy GPT disk0
    diskutil apfs create disk0s2 MyVolume
  • The commands given below create a Mac OS Extended (Journaled) partition, then convert to APFS.

    diskutil eraseDisk JHFS+ myVolume GPT disk0
    diskutil apfs convert disk0s2
  • The commands given below create a Mac OS Extended (Journaled) partition, then convert to an empty APFS container. Finally an APFS volume is added to the container..

    diskutil eraseDisk JHFS+ dummy GPT disk0
    diskutil apfs createContainer disk0s2
    Container=$(diskutil info disk0s2 | grep Container)
    diskutil apfs addVolume "${Container##* }" APFS myVolume

I suffered this issue last year and I've dug deeper and managed to find a fix! (I had to send it to apple when it happened to me), old posts have been archived but hope this helps if anyone has the issue in the future! :)

https://torbet.co/posts/Mac-Error-fix (archived version)

  • 1
    Please summarize the solution directly in your answer so others don't need to follow a link to get to it.
    – nohillside
    Jul 20, 2021 at 8:45

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .