Grub on Mac via EFI (Linux: /dev/sda1 Darwin: /dev/disk0s1) (MacBook Pro Early 2011 if it matters) I installed Debian Jessie 8.5 on my MacBook Pro over my old Bootcamp partition (Windows 8.1). I deleted the bootcamp partition with the partition manager in the Debian Installer and created two new partitions, rootfs and swap. I had my hard drive previously partitioned as listed below:


disk0s1: EFI (where GRUB is currently installed. I'll say more about this later)
disk0s2: OS X
disk0s3: Recovery HD
disk0s4: Windows 8.1 installed with Bootcamp Assistant, I deleted it later to install Debian.


My current partition layout:


disk0s1: Same as before, but with Grub installed at: (mount point)/EFI/debian/grubx64.efi
disk0s2: Same as before
disk0s3: Same as before
disk0s4: ext4 partition with Debian /
disk0s5: swap partition for Debian


I was able to get GRUB installed (I don't remember exactly what I did and I tried to reproduce it but did not succeed which is why I'm asking here). 

It was working until I cleared NVRAM (don't ask why I cleared NVRAM, it was a very stupid action of me). Before I cleared nvram, I got the GRUB menu when I booted without holding Alt, but when I booted when holding Alt and chose the Debian main partition, it would say "Missing Operating System", same for choosing it from the Startup Disk prefrence, or setting it manually with bless (because GRUB is installed on the EFI partition, not the Debian root partition. Please correct me if I'm wrong). 

So I presume that before I cleared NVRAM without holding Alt the system tried to boot from EFI, now it's trying to boot OS X from disk0s2 (there are no set variables that relate to the OS X root, so I guess the system automatically boots the first bootable HFS partition if there are no variables about booting). (To clarify, my problem is that the only way to boot Debian was to boot Grub, and the only way to boot Grub was if it was default startup disk when the system started, Grub can't be booted from the boot menu displayed when booting while holding Alt, and when I performed the stupid action of resetting NVRAM, the default startup disk went back to the OS X partition.) 

So how do I change the startup disk back to EFI/Grub (disk0s1/efi/debian/grubx64.efi)?
I'm posting the solution that worked for me in case of anyone else that has this problem comes across this. I changed the path of the grub EFI executable from /efi/debian/grubx64.efi to /efi/boot/bootx64.efi. Now it is appearing as a boot device in the boot selector, but it still wasn't booting by default. So to make grub boot by default I ran the following command (from Linux, not OS X): efibootmgr -d /dev/DRIVE -p PARTITION NUMBER -c -L "Grub" -l /efi/boot/bootx64.efi, where "DRIVE" is my internal hard drive, with GRUB, OS X and Debian installed, and "PARTITION NUMBER" is the EFI partition ID, so for me it would be efibootmgr -d /dev/sda -p 1 -c -L "Grub" -l /efi/boot/bootx64.efi