Granted that gparted didn't erase/secure erase data (overwriting important parts of your disk with zeros or arbitrary data) you probably can recreate the old standard GUID partition table which follows a fixed Apple scheme. gparted or similar gpt partitioning executables usually only modify the first and last 34 blocks (512 B) or 6 blocks (4096 B) of a disk.
The fast approach below won't work, if you've modified the disk previously (e.g installed Windows, resized the main volume and added a second partition). It only works with the "vanilla" OS X install partition scheme.
Recreating the old GUID partition table should restore the previous volume(s). Here is a related answer: HFS+ invalid number of allocation blocks.
The standard Apple GUID partition scheme looks like that:
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 part2-size 2 GPT part - partition type
part2-size+409640 1269536 3 GPT part - 426F6F74-0000-11AA-AA11-00306543ECAC
total_size-40 7
total_size-33 32 Sec GPT table
total_size-1 1 Sec GPT header
Here total-size is the total size of the disk in 512 B-blocks. part2-size usually is total-size - 1679216 in 512 B-blocks.
The partition type of the second partition is either 53746F72-6167-11AA-AA11-00306543ECAC (CoreStorage) or 48465300-0000-11AA-AA11-00306543ECAC (HFS+).
Newer systems on SSDs preferably have a CoreStorage- and older systems on HDDs an HFS+-type main partition.
Preparation:
- Detach any external drive
Restart to Internet Recovery Mode by pressing alt cmd R at startup.
The prerequisites are the latest firmware update installed, either ethernet or WLAN (WPA/WPA2) and a router with DHCP activated.
On a 50 Mbps-line it takes about 4 min (presenting a small animated globe) to boot into a recovery netboot image which usually is loaded from an Apple/Akamai server.
I recommend ethernet because it's more reliable. If you are restricted to WIFI and the boot process fails, just restart your Mac until you succeed booting.
Alternatively you may start from a bootable installer thumb drive (preferably Yosemite or El Capitan) or a thumb drive containing a full system (preferably Yosemite or El Capitan). If you boot to a full system and login as admin you have to prepend sudo
to execute some commands like gpt ...
or newfs_hfs ...
!
Remove the an old/wrong MBR/GUID partition table
- Enter
diskutil list
and gpt -r show /dev/diskX
(with x=0,1,2,3 etc) to get an overview. Usually the internal disk has the disk identifier disk0. Below I assume your internal disk is disk0.
- Enter
gpt destroy /dev/disk0
to remove any current GUID pt.
- Enter
gpt create -f /dev/disk0
to create a new empty GPT partition table and replace any MBR by an PMBR.
Restore previous partitions
EFI:
gpt add -b 40 -i 1 -s 409600 -t C12A7328-F81F-11D2-BA4B-00A0C93EC93B /dev/disk0
Recovery partition:
Now do the math: the start block $sbrecovery of the Recovery HD is total-size - 1269576. $sbrecovery has to be dividable by 8!
gpt add -b $sbrecovery -i 3 -s 1269536 -t C12A7328-F81F-11D2-BA4B-00A0C93EC93B /dev/disk0
Main volume
Do the math again: the size of the volume $mainvolumesize is total-size - 1679216. $mainvolumesize has to be divisible by 8! Your main volume may either be a CoreStorage or a HFS+-type partition. Here I assume it's the first one:
gpt add -b 409640 -i 2 -s $mainvolumesize -t 53746F72-6167-11AA-AA11-00306543ECAC /dev/disk0
Now check if diskutil list finds a CoreStorage volume:
diskutil cs list
If the GUUID partition table is properly restored and your main partition was a CoreStorage volume you should get an output similar to this one:
CoreStorage logical volume groups (1 found)
|
+-- Logical Volume Group A629E051-D7B0-4B8C-A803-074F62704636
=========================================================
Name: System
Status: Online
Size: 53946696192 B (53.9 GB)
Free Space: 16777216 B (16.8 MB)
|
+-< Physical Volume 90C09FC0-4215-4871-901B-70E2C9C7D464
| ----------------------------------------------------
| Index: 0
| Disk: disk0s2
| Status: Online
| Size: 53946696192 B (53.9 GB)
|
+-> Logical Volume Family F6962E38-50E4-4458-BFE6-CF2E179352F5
----------------------------------------------------------
Encryption Status: Unlocked
Encryption Type: None
Conversion Status: NoConversion
Conversion Direction: -none-
Has Encrypted Extents: No
Fully Secure: No
Passphrase Required: No
|
+-> Logical Volume BD36C73D-860D-4DC6-B125-AD624F448B88
---------------------------------------------------
Disk: disk2
Status: Online
Size (Total): 53496696192 B (53.5 GB)
Conversion Progress: -none-
Revertible: Yes (no decryption required)
LV Name: System
Volume Name: System
Content Hint: Apple_HFS
verify the CoreStorage volume with
diskutil verifyVolume diskX
(in the above CoreStorage example diskX is disk2 - check (Disk of Logical Volume), your diskX probably is disk14 or disk15)
If you get an error or no output your main volume either is a HFS+-type partition or the boundaries of the partition are wrong.
Then try the following and remove the CoreStorage-type partition and create an HFS+-type partition instead:
gpt remove -i 2 /dev/disk0
gpt add -b 409640 -i 2 -s $mainvolumesize -t 48465300-0000-11AA-AA11-00306543ECAC /dev/disk0
Verify the volume:
diskutil verifyVolume /dev/disk0s2
If you run into problems or get strange errors please post a comment to the answer!