7

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
Metal Gear
  • 1,489

1 Answers1

13

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 a 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
  • i ran all command and all ran successfully. Should i restart the mac now? – Metal Gear Dec 02 '18 at 05:09
  • I didn't take any backup though – Metal Gear Dec 02 '18 at 05:09
  • I do not think a restart is necessary. You can enter disktuil list to make sure disk0s2 recovered all the free space. A restart is probably a good idea anyway. I suppose you should confirm Windows no longer appears in the Startup Disk pane of the System Preferences application. – David Anderson Dec 02 '18 at 05:14
  • I have pasted the new output in the question. I have not restarted yet. – Metal Gear Dec 02 '18 at 05:26
  • Is everything seems ok? – Metal Gear Dec 02 '18 at 05:33
  • Looks good. Restart the Mac. – David Anderson Dec 02 '18 at 05:33
  • Restarted. Everything seems fine. Thanks very much. – Metal Gear Dec 02 '18 at 05:41
  • Thank you very much, @DavidAnderson, you saved my life !!! – mausamsion Feb 24 '19 at 15:19
  • This works really well, least scary way to do it when macos' GUI doesn't work – Louie Almeda Mar 29 '19 at 10:08
  • I had a slightly different problem, but the solution worked just as well. I tried removing the windows partition originally via bootcamp assistant. Which hung during the operation and I restarted. So I ended up with the 100GB dedicated to bootcamp missing. Running the disk erase commands led to disk not found. Guess those records were erased too. But running the resize command did the trick. My partition went back to 500GB from 400GB. It froze during the operation for a few minutes, but that's to be expected I learned since it's operating on the currently loaded disk. Thank you! – Capstone May 25 '19 at 08:05
  • @DavidAnderson I tryied restoring the partition from the BootCamp manager, the Windows partition was removed but the MacOS partition was not unified. I did what you mentinoed and got this by running sudo diskutil apfs resizeContainer disk0s2 0 Error: -69606: A problem occurred while resizing APFS Container structures – gfdsal May 19 '20 at 16:51