Mac time synch

Using vmware I always suspend my mac-os machine, so the time at revival is never correct… so how to force a time-synch:

source: here

10.14 Mojave

Mojave still uses timed, but ntpdate and the helpers ntpq are removed. To check and update your system time, you can call sntp directly.

$ sudo sntp -sS
sntp 4.2.8p10@1.3728-o Tue Mar 21 14:36:42 UTC 2017 (136.200.1~2533)
2018-09-29 19:42:41.448103 (-0200) +1087.742403 +/- 725.183462 s2 no-leap

Out of the box, a tracking file is missing. So if you get the error below when checking time:

kod_init_kod_db(): Cannot open KoD db file /var/db/ntp-kod: No such file or directory

create the file and change ownership to root. Some people reported this was actually breaking the ntp synchronization.

sudo touch /var/db/ntp-kod
sudo chown root:wheel /var/db/ntp-kod

Then run again to check if the error message is gone.

sudo sntp -sS

In case you have the same issue, i used to use the following commands before, but they hasn’t worked since whatever previous os version/update:

sudo ntpd -sS
sudo ntpdate -u

Have a nice day!