For me, the problem was the cable connecting the harddrive to the motherboard. Thankfully it was not the motherboard.
After buying the cable (part number
821-0812-A), I installed it into the computer, booted gparted (linux) off a flashdrive and checked to see if my harddrive came online. It did, and I was relieved.
Here is where I bought the part: http://www.aliexpress.com/item/For-Macbook-Pro-15-A1286-HDD-Cable-Connector-Test-OK/504281003.html
This might not fit your computer, you need to verify the model number of your cable. My MacBook's identifiers are as follows:
Model number: A1286
Model ID: MacBookPro5,4
Since I had erased my harddrive, I needed to reinstall mac on it. If you did not format your harddrive, the following information isn't necessary for you.
I then attempted to create a bootable USB flashdrive to install mac OSX Mavericks using TransMac (a windows utility). This failed, even after using a GUID partition table (gpt) on the flashdrive through
What worked was using Carbon Copy Cloner to make the bootable USB from an El Capitan .dmg file using a friend's Mac. I first formatted the USB drive using diskutility to Mac OS Extended, Journaled. Carbon Copy Cloner warned that my flashdrive would not be bootable, but it was wrong; the flashdrive booted.
I encountered the following problems while installing however:
Mac did not recognize my harddrive. I solved this by using diskutility from the bootable flashdrive to format my hard drive to Mac OS Extended, Journaled.
The next problem was
This was solved by closing the installer, opening terminal (from the installation operating system loaded off the live USB) and typing:
This sets the clock to Oct 10, 2015, allowing the installation to proceed because the dmg I used was either too old or too new for the code signature to be verified properly. I also read that
ntpdate -u time.apple.com works but I assume you need an internet connection for that, and I didn't have one.
Hope this helps