I suspect this this may be a duplicate, but I'm not sure what I should do considering almost everyone else has another macOS version or other partition size and I'm not sure how to generalize another answer to my setup.

So I wanted to delete a Linux partition back to APFS on my main HDD, but it split up the APPLE SSD SM0256F Media. I'm still on my macOS system, but I know that if I reboot I won't be able to access it. I've made a backup but would like to make the partition bootable/accessable since I can't backup programs etc. I still have a 16GB USB drive for use if that's necessary. Also Macintosh wasnt split up as it is now. Macintosh was the main drive that showed up in Disk utility. enter image description here

enter image description here

enter image description here

  /dev/disk0 (internal, physical):
       #:                       TYPE NAME                    SIZE       IDENTIFIER
       0:      GUID_partition_scheme                        *251.0 GB   disk0
       1:                        EFI EFI                     209.7 MB   disk0s1
       2: FFFFFFFF-FFFF-FFFF-FFFF-FFFFFFFFFFFF               205.8 GB   disk0s2

    /dev/disk1 (synthesized):
       #:                       TYPE NAME                    SIZE       IDENTIFIER
       0:      APFS Container Scheme -                      +205.8 GB   disk1
                                     Physical Store disk0s2
       1:                APFS Volume Macintosh HD            122.9 GB   disk1s1
       2:                APFS Volume Preboot                 45.8 MB    disk1s2
       3:                APFS Volume Recovery                517.0 MB   disk1s3
       4:                APFS Volume VM                      2.1 GB     disk1s4

    /dev/disk2 (external, physical):
       #:                       TYPE NAME                    SIZE       IDENTIFIER
       0:      GUID_partition_scheme                        *15.7 GB    disk2
       1:                        EFI EFI                     209.7 MB   disk2s1
       2:       Microsoft Basic Data SD CRUZER               15.5 GB    disk2s2

gpt -r show 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  401934440      2  GPT part - FFFFFFFF-FFFF-FFFF-FFFF-FFFFFFFFFFFF
  402344080   87890639         
  490234719         32         Sec GPT table
  490234751          1         Sec GPT header
  • See if you can successfully download and install gdisk. Post a comment when done. Can I assume you have SIP disabled? Jan 22, 2019 at 0:49
  • if I install the package, the manager says its installed, yet it doesn't pop up anywhere(not in Applications or Downloads) possibly because of SIP. SIP is enabled on Macintosh HD in Apple SSD nothing is listed.
    – N3ur0
    Jan 22, 2019 at 1:19
  • Open a new Terminal application window. What is the output when you enter the command csrutil status? What is the output when you enter the command gdisk </dev/null? Jan 22, 2019 at 2:52
  • csrutil status System Integrity Protection status: disabled. gdisk </dev/null -bash: gdisk: command not found
    – N3ur0
    Jan 22, 2019 at 13:37
  • Ok I got it to work. Command (? for help): gdisk </dev/null b back up GPT data to a file c change a partition's name d delete a partition i show detailed information on a partition l list known partition types n add a new partition o create a new empty GUID partition table (GPT) p print the partition table q quit without saving changes r recovery and transformation options (experts only) s sort partitions t change a partition's type code v verify disk w write table to disk and exit x extra functionality (experts only) ? print this menu Command (? for help):
    – N3ur0
    Jan 22, 2019 at 13:57

1 Answer 1


This solution will work because you already have System Integrity Protection (SIP) disabled.

Note: The current version of gdisk is version 1.0.4. This is the only version that will recognize Apple's new APFS format. So, if you already have an older version of gdisk already installed, then you will need to download and reinstall before proceeding.

The gdisk package can be downloaded by clicking on this link. This should place the file gdisk-1.0.4.pkg in your Downloads folder. Before installing this package, enter the command given below in a Terminal application window to remove the quarantine attribute.

xattr -d com.apple.quarantine ~/Downloads/gdisk-1.0.4.pkg

Once gdisk is installed, you will need to enter the commands given below.

Note: The sudo gdisk /dev/disk0 command may ask for your password.

sudo gdisk /dev/disk0

An example is given below.

Marlin:startup davidanderson$ sudo gdisk /dev/disk0
GPT fdisk (gdisk) version 1.0.4

Warning: Devices opened with shared lock will not have their
partition table automatically reloaded!
Partition table scan:
  MBR: protective
  BSD: not present
  APM: not present
  GPT: present

Found valid GPT with protective MBR; using GPT.

Command (? for help): t
Partition number (1-3): 2
Current type is 'Unknown'
Hex code or GUID (L to show codes, Enter = AF00): AF0A
Changed type of partition to 'Apple APFS'

Command (? for help): w

Final checks complete. About to write GPT data. THIS WILL OVERWRITE EXISTING

Do you want to proceed? (Y/N): y
OK; writing new GUID partition table (GPT) to /dev/disk0.
Warning: Devices opened with shared lock will not have their
partition table automatically reloaded!
Warning: The kernel may continue to use old or deleted partitions.
You should reboot or remove the drive.
The operation has completed successfully.
Marlin:startup davidanderson$ 

After restarting your Mac, you will need to enter the following command to reclaim the free space back to macOS.

sudo diskutil apfs resizeContainer disk0s2 0

When finished, you should enter the following command to enable SIP on your next restart.

sudo csrutil clear
  • You're amazing! I'm glad I posted this post because I probably would've done something wrong in internet recovery mode. Thanks alot sir
    – N3ur0
    Jan 22, 2019 at 14:34
  • Thank you so much, just had the issue after installing Ubuntu 18.04 on another partition. For an unknown reason, the AFPS container got corrupted and macOS volume was not recognized anymore.
    – Nibor Ndj
    Nov 9, 2019 at 16:42

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .