Skip to content

Instantly share code, notes, and snippets.

@nick-desteffen
Created August 5, 2011 01:50
Show Gist options
  • Star 39 You must be signed in to star a gist
  • Fork 8 You must be signed in to fork a gist
  • Save nick-desteffen/1126771 to your computer and use it in GitHub Desktop.
Save nick-desteffen/1126771 to your computer and use it in GitHub Desktop.
Set Time zone in OSX to UTC
sudo ln -sf /usr/share/zoneinfo/UTC /etc/localtime
@stiteler
Copy link

Thank you!

@jaseemabbas
Copy link

Worked!

@schavery
Copy link

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

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

life saver

@pipeu
Copy link

pipeu commented Apr 19, 2020

Perfect, thanks !!!

@vthinkhat
Copy link

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

@kumar303
Copy link

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

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