Changing system date from Terminal – macOS recovery

When you’re booting your Mac from the recovery partition and are planning to reinstall OS X, you might be met by the following message:

An error occurred while preparing the installation. Try running again

This is normally the signing on the installer has expired.

You need to set the system clock back to when the installer signing is valid.  To do this, we enter a new command. This command will be entered as follows:

date -u {month}{day}{hour}{minute}{year}

You can grab the current date using the following

date "+%m%d%H%M%Y.%S"

Every bracket should be replaced with a two-digit number based on UTC time. Below you see what the command should be for your current time and date – May 26th 2020 09:45. To avoid trouble with timezones, we will use UTC time instead (May 26th 2020 08:45). Which means, you can just enter it exactly like this:

date -u 0526084520

I normally use a general date such as

date -U 0101010119

Enter the command and hit return. You can then check if it was set correctly by running the first command again. If the date was wrong, it was likely that which caused the error, and after you quit the terminal it should be able to install OS X just fine.