Damaged version of macOS

I was recently trying to install a copy of macOS from a USB stick I'd made and kept getting an error saying the OS was damaged. I created the stick using both the command line and the OSX Install Disk Creator and whatever I did I got the following message:

This copy of the Install macOS Sierra.app application is damaged, and can't be used to install macOS.

No matter what I tried, I got the error. After some googling, I was led to this Apple thread‚Äč, however, as the installer was on a USB stick and not the computer, this fix did not work.

It turns out the computer thought it was 2012 (verified by typing date into the terminal) and so thought the new OS was corrupt. This was resolved (thanks to macworld ) by correcting the date of the computer.

Connect to the internet (if you can) and type the following in terminal. If you can't get to the internet, the macworld article explains an alternative method.

ntpdate -u time.apple.com