Creating a EFI partition I have been having trouble installing OS X Mavericks and I think I found the problem. It told me I couldn't boot up with Macintosh HD, so I verified my disk and I got this error: This disk doesn't contain an EFI system partition

So I figured out I can create one like this (tell me if I'm wrong): sudo gpt add -b 40 -i 1 -s 409600 -t C12A7328-F81F-11D2-BA4B-00A0C93EC93B disk0 from this question, but they also said the "index" must be 1, so I can't have anything at that index.

I ran diskutil list and this is the output:

/dev/disk0
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:      GUID_partition_scheme                        *250.1 GB   disk0
   1:                  Apple_HFS Macintosh HD            233.0 GB   disk0s1
   2:                 Linux Swap                         4.0 GB     disk0s2


So I need to figure out how to move the indexes of Macintosh HD and that Linux Swap thing to indexes 2 and 3 instead of 1 and 2.

I don't know if this can be done without wiping and formatting my hard drive which I don't want to do, but if it can I would love to know how. Thanks!

By the way I'm on OS X mountain lion
Usually EFI is on your Macintosh HD. It's likely still there, but not used due to messed up settings. This very easy to fix:


Boot into a Recovery partition, DVD, or USB drive. Using the installation media that came with your device will suffice.
Once loaded, you'll be presented an interface like:





Close this window, and you'll be prompted to choose between Startup disk, Cancel, and Restart.
Select Startup Disk. The mere act of opening this utility with run the appropriate bless command in the background, repairing your EFI setup.
Select Macintosh HD
Restart
Come back to Ask Different and up vote this successful answer :D