Unable to remove Bootcamp partition from Mac OS X El Capitan

bootcampdiskutilpartitionterminal

Yes, I know this question has been asked many, many times. I promise I have tried everything all of the solutions that I could find. I'm running OC X El Capitan on a MacBook Air.

My latest attempt was to delete my Bootcamp partition with diskutil in Terminal. Output from diskutil list:

   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:      GUID_partition_scheme                        *251.0 GB   disk0
   1:                        EFI EFI                     209.7 MB   disk0s1
   2:          Apple_CoreStorage Macintosh HD            199.4 GB   disk0s2
   3:                 Apple_Boot Recovery HD             650.1 MB   disk0s3
   4:         Microsoft Reserved                         134.2 MB   disk0s4
   5:                  Apple_HFS DELETEME                50.5 GB    disk0s5
/dev/disk1 (internal, virtual):
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:                  Apple_HFS Macintosh HD           +199.0 GB   disk1
                             Logical Volume on disk0s2
                             1BF2795D-D4B7-4C5C-BD7A-4243ADA8BD64
                             Unlocked Encrypted

But then the minus sign was grayed out in Disk Utility when I went to finally delete it and merge my harddrive back together.

So I tried to merge Bootcamp with my Apple core storage using diskutil and I got a message that 'the chosen disk does not support resizing.'

The chosen disk does not support resizing.
Do you wish to format instead? (y/N) 

I am at a loss. I have tried everything.

Output from diskutil cs list:

CoreStorage logical volume groups (1 found)
|
+-- Logical Volume Group 86423689-8512-4D62-B2F1-81622E3DEC14
=========================================================
Name:         Macintosh HD
Status:       Online
Size:         199352344576 B (199.4 GB)
Free Space:   90112 B (90.1 KB)
|
+-< Physical Volume E574056B-8F12-4160-A60F-A370A52302F0
|   ----------------------------------------------------
|   Index:    0
|   Disk:     disk0s2
|   Status:   Online
|   Size:     199352344576 B (199.4 GB)
|
+-> Logical Volume Family 5DBF94A9-3393-4EE2-B0B0-BA9757DD5C33
    ----------------------------------------------------------
    Encryption Type:         AES-XTS
    Encryption Status:       Unlocked
    Conversion Status:       Complete
    High Level Queries:      Fully Secure
    |                        Passphrase Required
    |                        Accepts New Users
    |                        Has Visible Users
    |                        Has Volume Key
    |
    +-> Logical Volume 1BF2795D-D4B7-4C5C-BD7A-4243ADA8BD64
        ---------------------------------------------------
        Disk:                  disk1
        Status:                Online
        Size (Total):          198999932928 B (199.0 GB)
        Revertible:            Yes (unlock and decryption required)
        Revert Status:         Reboot required
        LV Name:               Macintosh HD
        Volume Name:           Macintosh HD
        Content Hint:          Apple_HFS

Output from sudo gpt -r show /dev/disk0

   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:      GUID_partition_scheme                        *251.0 GB   disk0
   1:                        EFI EFI                     209.7 MB   disk0s1
   2:          Apple_CoreStorage Macintosh HD            199.4 GB   disk0s2
   3:                 Apple_Boot Recovery HD             650.1 MB   disk0s3
   4:         Microsoft Reserved                         134.2 MB   disk0s4
   5:                  Apple_HFS DELETEME                50.5 GB    disk0s5
/dev/disk1 (internal, virtual):
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:                  Apple_HFS Macintosh HD           +199.0 GB   disk1
                                 Logical Volume on disk0s2
                                 1BF2795D-D4B7-4C5C-BD7A-4243ADA8BD64
                                 Unlocked Encrypted
wireless-10-105-163-63:~ Meg$ sudo gpt -r show /dev/disk0
      start       size  index  contents
          0          1         PMBR
          1          1         Pri GPT header
          2         32         Pri GPT table
         34          6         
         40     409600      1  GPT part - C12A7328-F81F-11D2-BA4B-00A0C93EC93B
     409640  389360048      2  GPT part - 53746F72-6167-11AA-AA11-00306543ECAC
  389769688    1269760      3  GPT part - 426F6F74-0000-11AA-AA11-00306543ECAC
  391039448       1576         
  391041024     262144      4  GPT part - E3C9E316-0B5C-4DB8-817D-F92DF00215AE
  391303168   98669400      5  GPT part - 48465300-0000-11AA-AA11-00306543ECAC
  489972568     262151         
  490234719         32         Sec GPT table
  490234751          1         Sec GPT header

Best Answer

You need to remove the Apple_HFS and Microsoft Reserved partitions before recovering the free space. The commands to enter are given below.

sudo  diskutil  erasevolume  free  n  disk0s5
sudo  diskutil  erasevolume  free  n  disk0s4
sudo  diskutil  cs  resizestack  1BF2795D-D4B7-4C5C-BD7A-4243ADA8BD64  0