MacOS – Unable to use gpt to restore efi partition

bootefimacosrecovery

I accidentally deleted my efi partition, which I now know is bad news bears. I found a guide here to restore it without losing data, but even though I'm booting from usb and have unmounted all partitions, I'm still getting the error gpt remove: unable to open device "disk0": resource busy.

Everything I'm reading says to boot from an OSX usb installer disk, and use diskutil unmountdisk disk0 and then gpt will work. I've definitely done both of these things but it's still telling me the disk is mounted…

Could someone recommend anything else to try? Much thanks

Best Answer

I figured it out, my hd was getting mounted under Volumes and had to be removed with diskutil unmount /Volumes/Macintosh\ HD

Don't know why unmountdisk wasn't fixing this but whatever