I was trying to reinstall an old Apple MacBook Pro from 2009 for a friend. They had previously upgraded all the way to the newest operating system macOS Sierra version 10.12.6 and they wanted to do a clean installation to sell the computer on eBay.

He booted in recover mode Command-R at startup, did the usual, first formatted the drive, then went to do the installation. Should be very easy.

Recover mode, gives the option to reinstall  OS X El Capitan.  I know this machine was working fine, but I’m getting an error when trying to run the installer.

Error message: An error occurred while preparing the installation.  Try running this application again.

I remember having this problem once before.  After wasting an hour messing around, I noticed the clock date was reset to 1/1/2001.  They must have left the computer unplugged and the battery died and reset the system time.

I then opened up Terminal while in the recovery menu and reset the date to today.  Just type in “date” with format mmddHHMMYYYY, example:

date 020416002018

mm = month
dd = day
HH = hour
MM = minute
YYYY = year

That will set the computer to 2/4/2018 at 4:00pm, enter your current date and time.

Now quit Terminal application, and run the OS X El Capitan installer again.

Everything should be good now.