Windows – The startup disk cannot be partitioned or restored to a single partition. Windows 10 and Mojave

bootcampdisk-utilitymojavepartitionwindows

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

The startup disk must be formatted as a single Mac OS Extended
(Journaled) volume or already partitioned by Boot Camp Assistant for
installing Windows.

I had installed Windows 10 via bootcamp in my mac. Current version is 10.14.1

Now I don't want windows and need that space back but getting above error when I go bootcamp to remove it.

This is the output of diskutil list

/dev/disk0 (internal, physical):
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:      GUID_partition_scheme                        *251.0 GB   disk0
   1:                        EFI EFI                     209.7 MB   disk0s1
   2:                 Apple_APFS Container disk1         181.3 GB   disk0s2
   3:       Microsoft Basic Data BOOTCAMP                60.3 GB    disk0s3
   4:           Windows Recovery                         509.6 MB   disk0s4

/dev/disk1 (synthesized):
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:      APFS Container Scheme -                      +181.3 GB   disk1
                                 Physical Store disk0s2
   1:                APFS Volume Macintosh HD            116.4 GB   disk1s1
   2:                APFS Volume Preboot                 44.6 MB    disk1s2
   3:                APFS Volume Recovery                512.8 MB   disk1s3
   4:                APFS Volume VM                      4.3 GB     disk1s4

And this is of diskutil cs list

No CoreStorage logical volume groups found

Can anybody please help me to solve this problem?

Output after I tried commands given in the first answer

❯ diskutil list
/dev/disk0 (internal, physical):
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:      GUID_partition_scheme                        *251.0 GB   disk0
   1:                        EFI EFI                     209.7 MB   disk0s1
   2:                 Apple_APFS Container disk1         250.8 GB   disk0s2

/dev/disk1 (synthesized):
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:      APFS Container Scheme -                      +250.8 GB   disk1
                                 Physical Store disk0s2
   1:                APFS Volume Macintosh HD            116.4 GB   disk1s1
   2:                APFS Volume Preboot                 44.6 MB    disk1s2
   3:                APFS Volume Recovery                512.8 MB   disk1s3
   4:                APFS Volume VM                      3.2 GB     disk1s4

Best Answer

This is a very common question. Again, here is the commands you need to enter in a Terminal application window.

sudo diskutil eraseVolume free none disk0s4
sudo diskutil eraseVolume free none disk0s3
sudo diskutil apfs resizeContainer disk0s2 0

These commands will have removed the Windows partitions and expanded the macOS partition to recover the free space. However, there will still be Windows boot files stored in the hidden EFI partition (disk0s1). These files can be removed by entering the commands given below.

Note: If you have an legacy BIOS booting Windows, then these Windows boot files would normally not exist. In this case, the rm commands would produce an error message.

sudo diskutil mount disk0s1
cd /Volumes/EFI/EFI
rm -r Boot
rm -r Microsoft
cd ~
diskutil unmount disk0s1