Unable to remove Windows Boot Camp partition
About a year ago, I installed Windows 10 via Boot Camp, which I now want to remove, but it doesn't seem to be done causing issues... When I go into the Boot Camp Assistant, I get this message:
My Disk Utility looks like this:
diskutil
list gives me:
/dev/disk0 (internal):
#: TYPE NAME SIZE IDENTIFIER
0: GUID_partition_scheme 1.0 TB disk0
1: EFI EFI 314.6 MB disk0s1
2: Apple_APFS Container disk1 912.4 GB disk0s2
3: Microsoft Basic Data Windows 78.8 GB disk0s3
4: Windows Recovery 480.2 MB disk0s4
/dev/disk1 (synthesized):
#: TYPE NAME SIZE IDENTIFIER
0: APFS Container Scheme - +912.4 GB disk1
Physical Store disk0s2
1: APFS Volume Macintosh HD 474.7 GB disk1s1
2: APFS Volume Preboot 20.5 MB disk1s2
3: APFS Volume Recovery 517.8 MB disk1s3
4: APFS Volume VM 2.1 GB disk1s4
/dev/disk2 (external, physical):
#: TYPE NAME SIZE IDENTIFIER
0: GUID_partition_scheme *8.0 TB disk2
1: EFI EFI 209.7 MB disk2s1
2: Microsoft Basic Data Seagate 02 8.0 TB disk2s2
/dev/disk3 (external, physical):
#: TYPE NAME SIZE IDENTIFIER
0: GUID_partition_scheme *8.0 TB disk3
1: EFI EFI 209.7 MB disk3s1
2: Microsoft Basic Data Seagate 01 8.0 TB disk3s2
What's the safest way to completely remove the partition/Windows? I'm just scared of messing something up. Thanks in advance!
Solution 1:
The proper commands, to remove Windows and add the free space back to macOS, are given below. The commands should work unless there is a problem with APFS.
sudo diskutil eraseVolume free none disk0s4
sudo diskutil eraseVolume free none disk0s3
sudo diskutil apfs resizeContainer disk0s2 0
The next sequence of commands removes any Windows boot code that may exist in the hidden EFI partition.
diskutil mount disk0s1
cd /Volumes/EFI
rm -fr EFI/Windows
rm -fr EFI/Boot
cd /
diskutil unmount disk0s1
Solution 2:
Safe for me it to disconnect all external drives and boot to recovery disk.
Your windows partitions are all after the Mac Apple_APFS Container disk1 so if you were to go into Disk Utility from the recovery OS - you should be able to grow it to reclaim the small amount of "wasted" space you'll have left over after you delete the 80 GB reserved for windows.
If you're handy in the command line and have a backup of your Mac and can wipe and reinstall the OS easily, I bet we could come up with a more risky diskutil command to just grow the APFS container / deleting the rest of the items, but that's less easy and less safe. One space or syntax error or the wrong digit and your Mac could be deleted and you'd need your backup to recover.