explorations in dev, science, sci-fi, games, and other fun stuff!

Quickly Sync Mac OS’s Time via Script

I’ve noticed lately that my computer’s time is off by over a minute, sometimes several. This happens as after I have put my computer in standby by closing the lid. The problem it causes is that with the time out of sync, I cannot use my auth tokens to log into my work’s VPN. So instead of opening the Time & Date preferences, I use this one line command to quickly update.

Open Terminal and type:

sudo ntpdate -u time.apple.com

You can even create an alias in your .bash_profile to make it simpler: