How can I merge primary APFS partition with other empty APFS partition? Using the latest Macbook Pro with currently High Sierra 10.13.1, I was using bootcamp for a year, and I decided to get rid of the Bootcamp partition this morning. The Bootcamp utility would not let me erase this partition, so I decided to do it through Disk Utility.

I did everything I could to "erase" it, but I can't find any way to merge this 58GB partition with my primary Macintosh HD one.



In Disk Utility, if I want to erase the container Disk2, it tells me that an internal error occured... The BOOTCAMP partition is actually formatted as APFS...



$ diskutil list




How can I merge those two partitions ?

EDIT : The BOOTCAMP partition is now gone but I can't extend the primary one ...
If anyone still looking for answer.

Step 1: Delete the container

sudo diskutil apfs deleteContainer disk0s3


this will change the container to Apple_HFS Untitled                98.9 GB    disk0s3

Step 2: Erase the volume

sudo diskutil eraseVolume "Free Space" %noformat% /dev/disk0s3


Step 3: Resize the container

sudo diskutil apfs resizeContainer disk0s2 0