Setting the date/time in macOS (10.14+) recovery mode


Posted on August 5, 2020 by alanysiu

Back in ye olde days, you used to be able to run ntpdate -u time.apple.com to update the date/time automatically in recovery mode, but Apple removed ntpdate in Mojave.

In regular bootup, you can run sntp -sS time-a.nist.gov and may get an error like kod_init_kod_db(): Cannot open KoD db file /var/db/ntp-kod: No such file or directory, but the date and time actually will update properly. If you try that command in recovery mode, though, the date and time will not update.

Similarly, in regular bootup, you can run systemsetup -setusingnetworktime off && systemsetup -setusingnetworktime on to resync the date/time, and that totally works. In recovery mode, there is no systemsetup command.

So what do we have left in recovery mode?

You can use the date command to set the command manually. Just keep in mind that booted into regular mode, you’re usually going to see the date/time in your local time zone, whereas you’ll see the date/time in UTC when booted into recovery mode.

To update the time to, for example, 2:25pm PDT (so 9:25pm UTC) for June 3, 2020, you’d run a command like this in recovery mode:

date 0603212520

That’s 06 (June) 03 (the date) 21:25 (9:25pm on a 24-hour clock) 20 (the year, 2020).

P.S. @ClassicII on the MacAdmins Slack did testing and found sntp binary works fine in recovery mode. I did my own testing and found it did not. So, your mileage may vary? Maybe give it a shot, but… yeah, you may have to fall back to manually setting the date/time if it doesn’t work.


Uncategorized

2

2 thoughts on “Setting the date/time in macOS (10.14+) recovery mode

  1. September 13, 2022 at 11:06:09 PM by Pol

    Respect 😘

    Reply

  2. September 17, 2023 at 12:42:34 AM by John

    Thanks for your advice !

    Reply

Leave a Reply

Your email address will not be published. Required fields are marked *

Alan Siu's Blog