Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Set Time zone in OSX to UTC
sudo ln -sf /usr/share/zoneinfo/UTC /etc/localtime
@stiteler
Copy link

stiteler commented Feb 23, 2017

Thank you!

@jaseemabbas
Copy link

jaseemabbas commented Mar 15, 2017

Worked!

@schavery
Copy link

schavery commented Apr 23, 2018

still works on macOS 10.13.4

@ad-si
Copy link

ad-si commented May 21, 2019

There is also sudo systemsetup -settimezone GMT.
Not sure what difference it makes …

@j-walker23
Copy link

j-walker23 commented Jul 24, 2019

Does removing the link revert it back?

@a2f0
Copy link

a2f0 commented Jul 24, 2019

@j-walker23 just setting it in the system preferences updates the symlink, I verified it.

@j-walker23
Copy link

j-walker23 commented Jul 27, 2019

@deepeeess Thanks for the response! I was looking for a easy progrmatic way to flip back and forth. Which I'm sure there is.

@psyanite
Copy link

psyanite commented Apr 16, 2020

life saver

@pipeu
Copy link

pipeu commented Apr 19, 2020

Perfect, thanks !!!

@vthinkhat
Copy link

vthinkhat commented Apr 20, 2020

Works for macOS Mojave Verison 10.14.6 (18G103). Thanks

@kumar303
Copy link

kumar303 commented Apr 24, 2020

I verified that selecting UTC - United Kingdom in the Date & Time panel on macOS 10.14.6 really does set it to UTC and not to UK time, which could be UTC+1 during daylight savings.

@BASoapbox
Copy link

BASoapbox commented Apr 30, 2020

Hi all! I am having issues with meeting invites from my client in Dubai and I live in UK. While the invite says 4PM AST (Arabian Standard Time) is shows up at 2PM UK time, but should be 1PM UK time. Any fix you can suggest?

@paul3412
Copy link

paul3412 commented Jul 13, 2020

works on MacOs Mojave thanks !
any tip to revert this (in case i need to in the future)

@Gerst20051
Copy link

Gerst20051 commented Mar 15, 2022

Command To See What Your Local Time Is Currently Set To:

[$]> ls -la /etc/localtime

/etc/localtime -> /var/db/timezone/zoneinfo/America/Los_Angeles

Command To Set Your Local Time To UTC

[$]> sudo ln -sf /usr/share/zoneinfo/UTC /etc/localtime

NOTE: When I Set It To UTC - United Kingdom Via System Preferences It Becomes:

[$]> ls -la /etc/localtime

/etc/localtime -> /var/db/timezone/zoneinfo/UTC

Command To Switch Your Local Time Back To The Original Time Zone

[$]> sudo ln -sf /var/db/timezone/zoneinfo/America/Los_Angeles /etc/localtime

FYI: I Compared Both Of The UTC Files And They Are Exactly Matching

[$]> delta /usr/share/zoneinfo/UTC /var/db/timezone/zoneinfo/UTC
or
[$]> diff /usr/share/zoneinfo/UTC /var/db/timezone/zoneinfo/UTC

[$]> cat /usr/share/zoneinfo/UTC /var/db/timezone/zoneinfo/UTC

TZif2UTCTZif2UTC
UTC0
TZif2UTCTZif2UTC
UTC0

I created the following shell aliases to make switching timezones easy.

# output the current timezone
alias timezone.current='exa -l /etc/localtime'

# set the timezone to my default local timezone
alias timezone.default='sudo ln -sf /var/db/timezone/zoneinfo/America/Los_Angeles /etc/localtime'

# set the timezone to utc
alias timezone.utc='sudo ln -sf /var/db/timezone/zoneinfo/UTC /etc/localtime'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment