Why does recovery mode keep failing to install OS X on a new hard drive? I had a hard drive die in my Macbook Pro (from ~2012) and I replaced it. I booted into recovery mode and tried to install an OS on the new SSD, but it keeps hanging at "installing additional components" and eventually (after several hours) failing.

I used command + l to see the logs, and it keeps counting up the chunks it receives, only to eventually say "Failed to verify InstallESD.dmg: hdiutil verify failed", at which point it restarts the download process.

At one point, I did get through the process successfully, but since that got me to a desktop with Snow Leopard, I immediately tried to update to El Capitan using the App Store, which also failed, saying "This copy of the Install OS X El Capitan application can't be verified. It may have been corrupted or tampered with during downloading."

Why are these installations failing?
Bad drive cable

I finally took this to an apple store, and the techs diagnosed it as a bad drive cable - a common problem for Macbooks from that year, they said. With a new cable, the Recovery Mode installation worked, the El Capitan upgrade worked, and the machine has been running smoothly for months.