You are absolutely fantastic! Thank you so much for this solution! I had a very similar problem and used your solution to repair my Bootcamp partition. For step 6 I had to use "2 4" instead of "2 3", because of the way my partitions were... Maybe that should have been "2 3 4"?? But nonetheless I now can boot into either Mac or Bootcamp!
When I boot using the Alt/Option key, I have Mac, EFI boot and Windows listed. I am guessing that I should have Recovery in place of EFI, so maybe I didn't do this totally correctly. Hopefully this won't cause any probs in future, but for now it works great! :-) If anyone know if or how I should correct this, please let me know.
Oh, btw, before I did any of this I had to turn off the "rootless". So I did that, and re-enabled it after I had finished:
https://www.quora.com/How-do-I-turn-off-the-rootless-in-OS-X-El-Capitan-10-11
Here's what I did:
sudo gdisk /dev/rdisk0
GPT fdisk (gdisk) version 1.0.1
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): p
Disk /dev/rdisk0: 937703088 sectors, 447.1 GiB
Logical sector size: 512 bytes
Disk identifier (GUID): E4C92C97-8BA9-4B97-82C7-E7FCCB948C40
Partition table holds up to 128 entries
First usable sector is 34, last usable sector is 937703054
Partitions will be aligned on 8-sector boundaries
Total free space is 3149 sectors (1.5 MiB)
Number Start (sector) End (sector) Size Code Name
1 40 409639 200.0 MiB EF00 EFI System Partition
2 409640 543855399 259.1 GiB AF00 Untitled
3 543855400 545124935 619.9 MiB AB00 Recovery HD
4 545126400 937701375 187.2 GiB 0700 BOOTCAMP
Command (? for help): r
Recovery/transformation command (? for help): o
Disk size is 937703088 sectors (447.1 GiB)
MBR disk identifier: 0x6C4A997C
MBR partitions:
Number Boot Start Sector End Sector Status Code
1 1 937703087 primary 0xEE
Recovery/transformation command (? for help): h
WARNING! Hybrid MBRs are flaky and dangerous! If you decide not to use one,
just hit the Enter key at the below prompt and your MBR partition table will
be untouched.
Type from one to three GPT partition numbers, separated by spaces, to be
added to the hybrid MBR, in sequence: 2 4
Place EFI GPT (0xEE) partition first in MBR (good for GRUB)? (Y/N): y
Creating entry for GPT partition #2 (MBR partition #2)
Enter an MBR hex code (default AF):
Set the bootable flag? (Y/N): n
Creating entry for GPT partition #4 (MBR partition #3)
Enter an MBR hex code (default 07):
Set the bootable flag? (Y/N): y
Unused partition space(s) found. Use one to protect more partitions? (Y/N): n
Recovery/transformation command (? for help): o
Disk size is 937703088 sectors (447.1 GiB)
MBR disk identifier: 0x6C4A997C
MBR partitions:
Number Boot Start Sector End Sector Status Code
1 1 409639 primary 0xEE
2 409640 543855399 primary 0xAF
3 * 545126400 937701375 primary 0x07