Unable to format internal drive as APFS on 2018 MacBook Pro 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 disk0 → diskutil apfs createContainer /dev/disk0s2 → diskutil 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.
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