Regain space from failed attempt to install Windows Using Boot Camp

bootcampdisk-utilityhard drive

I'm kind of stuck with a 30GB partition on the hard drive of my MBP that I cannot regain. This is what happened:

  1. I used boot camp to try to install Win 10 on a partition

  2. Once it rebooted into Win10 setup, it failed to install the system on the partition

  3. I tried to use Boot Camp Assistant to remove the partition but I'm getting this message:

The startup disk cannot be partitioned or restored to a single
partition.

Then, I used disk utility to try to merge my main partition with the mentioned above but it won't let me remove it (I tried from recovery mode with the same results)

Minus icon is disabled

I'm using macOS Sierra 10.12.3 on my Late 2015 15" MBP.

Best Answer

If you're not afraid of the command line

First show your partitioning

sudo gpt show /dev/diskX

Remove the partition

sudo gpt remove -i 2 /dev/diskY

Replace X with your disk number, and the index "2" with the partition number of the windows partition.

Afterwards, use the gui to enlarge your partition.