GMT timezone problem in Mac OS X

I have had an odd problem with my timezone settings on my Mac over the last few days, I went on holiday recently and (of course) I took my Mac, when I went to change the timezone I discovered that the settings would not "stick", and instead of going back to the timezone I started with, actually went to GMT.

In any case, I worked out what the problem was, so I thought I should post the solution in case anyone else has runs across the same thing.

 

The cause of the GMT timezone problem in Mac OS X

In a nutshell the problem was being caused by /etc/localtime having the wrong permissions. It was pointing to the correct timezone, but the permissions were such that my user did not have access to the file.

At some point (I have no idea when) my default umask (the NSUmask) got changed from 18 (0x12 hex, 022 octal) to 63 (0x3f hex, 077 octal). This effectively means that, by default, files and links that get created will be read/write for the owner only.

Normally this shouldn't be a problem, but it can be when files created by one user on your machine need to be accessed by other users. In this case "System Preferences" was creating a new symbolic link (/etc/localtime) to the correct timezone file as user 'root' but the link didn't allow anyone (i.e. me) access to the linked to file, even though the permissions on the timezone file were fine.

Fixing the problem therefore is a simple three step process:

  1. Correct the default umask (NSUmask in this case)
  2. Logout and log back in
  3. Replace the timezone symbolic link

 

Fixing the GMT timezone problem step-by-step in Mac OS X

Step 1: Correct the default umask

Open up a terminal window and enter the following command:

sudo defaults write /Library/Preferences/.GlobalPreferences NSUmask 18


You will be prompted for your password.

NB: Don't be tempted to use the '-g' or '-globalDomain' switch in place of the specific domain above, they appear to be different. If you did not understand that last sentence then feel free to ignore it.

 

Step 2: Logout and log back in

Logout of your current session (Apple menu -> Log Out [username]), and then log back in. You may wish to save any unsaved documents and close any open applications as they will be shut down by the log out.

 

Step 3: Replace the timezone symbolic link

Changing the default umask (step 1) fixed the basic problem but the symptoms will remain until you replace the incorrect link as well.

 

Step 3a: Removing the timezone file

Open a terminal window and enter the following command:

sudo rm -fr /etc/localtime


This will delete the problematic symbolic link, if the command succeeds there will be no message.

Close the terminal window.

 

Step 3b: Reset the timezone

In the system preferences, go into "Date and Time" and select your correct timezone.
NOTE: The "Closest City" drop down will show "GMT" initially, and if you attempt to use the drop down it will be empty. To have the drop down list correctly populated click on the world map first - this will force the drop down to become populated.

Close the system preferences, when you do this the symbolic link /etc/localtime will be created for you.

The time in the menu bar should now show the correct time, and if you go back into the System Preferences the correct timezone should be shown.

Comments

Click on Finder. Click on

Click on Finder. Click on "Go" toolbar on top of your screen. Click on "Go to folder"
Type /private/etc/ press Enter or click Go. Delete or move to Trash "localtime"
Now you can set your time.

Apple Support solution

For some reason, instructions didn't work for me - but I did find article TS2538 in Apple Support which did. Sounds like doing the exactly the same thing via Finder windows, so don't understand why Terminal method didn't work but there we are. Apple method a bit easier too...

THANK YOU!

That worked great. Thank you!

I have a G4/800 with OS X

I have a G4/800 with OS X 10.2.8 and Classic running. I have a problem with Classic app print jobs being scheduled to print 6 hours into the future. I had this once before and found that it had to do with the time zone settings in Classic being different than the setting in OS X. I booted into OS 9 and found that yes, the time zone was not set properly so I set it (to Regina). I then booted back to X and checked the time zone setting there. I found it to be blank. Then, when I chose Regina from the list, it said the time zone was GMT. Now selecting numerous other cities around the world the time zone does not change.
I zapped the PRAM and repaired permissions but it still is not working. I suppose it could be a corrupt plist or pref file but could someone tell me what file to delete? Or, does someone know the actual solution to my problem?
----------------------------
mcdst certification | mcitp certification | mcse braindumps | mcts certification

Grateful

As one of us mortified to open the terminal window, I add my thanks! Now my clocks match and I don't have to move to Europe to have them be accurate- although maybe that would have been a good excuse to move east.

Thanks!
Carolyn

Thank you many times over

Your description of the problem was spot on, your very detailed, simple instructions were EXCELLENT. Thank you for taking the time to put this information together so that it becomes easy for the rest of us. Your effort and skill are greatly appreciated.

Sean Brown

You deserve a lot of beer

Thank you sooooooo much. There are way too many people that think they know what they're doing and fill the forums with useless answers. I'm not a stupid person that bought a mac because they're "friendly". I've been working on Macs for 15 years, and know my way around them quite well, just not as technical as you. You have no idea how many people were posting dumbed down replies about changing the time zone in my preference panel! Thank you a million times over.

So quite seriously, where do you live because if you're close enough... my husband works at a brewery and I will happily ship you some beer! It's good stuff too.

Thanks a lot !!! You saved

Thanks a lot !!!
You saved my life !

Keith - well done !...easy

Keith - well done !...easy to execute instructions and it fixed my annoying GMT issues!! Apple should be paying you a stipend.

THANK YOU!

This appears to have worked, and made my life measurably less stressful if so. One suggestion: mention in the instructions that when you enter a password in terminal, it doesn't give you any asterisks or anything, and when you hit the enter key, it just puts up a prompt. If you don't know that, it's hard to tell that you did things right.

Thank you very much for

Thank you very much for posting this! You saved me!

time zone fix in os 10.5.8

GREAT _ YOUR INSTRUCTIONS EASY = PERFECT - ENDING FRUSTRATION - I SENT YOU SOME GOOD OLD AMERICAN GREENBACKS IN APPRECIATION. MAYBE YOU COULD PURCHASE A 6 PACK (AT LEAST THEY USE TO BE GOOD OLD GREENBACKS, AND ABLE TO BUY A 6 PACK, MAYBE I SHOULD HAVE SENT EUROS.:), OR NZ CURRENCY, ANYWAY THANKS
BOB

That was really a nice and

That was really a nice and informative post. Thanks for this great article.

Thank You

Thank You Thank You...I was setting up an I-Mac for my wife and it had the same problem...

great stuff man!

thanks for posting this

Not quite, but this helped a lot

We just used Migration Assistant to transfer all my mom's data from her old iMac to a new one and we have this problem. In her case /etc/localhost has somehow been created as a directory instead of a sym link, and contains 1 file, a copy of the timezone file it is supposed to link to. Next time I have a chance I will delete the directory and see if the link will be created correctly.

correction

for those who are having problems with the removal check step 3a

Step 3a: Removing the timezone file

Open a terminal window and enter the following command:

sudo rm -fr /etc/localtime

ABOVE SHOULD READ

sudo rm -rf /etc/localtime

"the unix guys didnt notice because this removal command (rm -rf) is automatic so its easy to miss"

Does this work for Tiger 10.4.11?

I followed the directions:
sudo defaults write /Library/Preferences/.GlobalPreferences NSUmask 18
I logged out and back in.
sudo rm -fr /etc/localtime
I opened Date & Time preferences and set time zone to New_York. After exiting, tz reverts to GMT.

Then, I did some checking:
ls -l /private/etc localtime
ls: /private/etc/localtime: Permission denied
lrwxr-x--- 1 root wheel 36 Aug 31 15:15 /private/etc/localtime
This link points to /usr/share/zoneinfo/America/New_York

ls -l /etc/localtime
ls: /etc/localtime: Permission denied
lrwxr-x--- 1 root wheel 36 Aug 31 15:15 /etc/localtime

ls -l /usr/share/zoneinfo/America/New_York
-rw-r--r-- 3 root wheel 1267 Jan 12 2007 /usr/share/zoneinfo/America/New_York

sudo defaults read /Library/Preferences/.GlobalPreferences NSUmask
18
Correct!

Each time I remove /etc/localtime and set the new TZ, It creates the same link.
Do I need to reboot?
Could the file /usr/share/zoneinfo/America/New_York be corrupted?

Great

Simple and efficient! Just great! Worked perfectly! Thanks!

Thank you!

I just upgraded from an iMac G5 to a new Intel mac, and your instructions were well written and they helped me solve my time zone problem.

Same Problem after all the Steps

Have tried everything as set out numerous times and still have GMT as timezone. Same as 30 March, 2009 - 13:35.

Have deleted etc/localtime. Have also manually tried the following as well:

- recreating localtime Symbolic link to my time zone usr/share/zoneinfo/canada/mountain
(same us on other Leopard Computer that has time set correctly) , placed in etc... folder after deleting orignal and confirmed thru terminal that symbolic link was correct. (ls -la /etc/localtime)
Checked to make sure file was correct (zdump -v /etc/localtime)

- tried using systemsetup -settimezone America\Edmonton (in the -listtimezones option the Canada/mountain zone does not show up but edmonton does) but did not work

- tried using zic command to update time zones in list for folder canada and individual file Mountain.

For each of above tried with going thru all steps and numerous reboots. Cleared NVRAM still same thing. Tried disk repair. The zoneinfo folder also appears correctly with all the same folders as on other mac with leopard. Tried update to 10.5.8 and same issue.

Finally to fix After cleared NVRam - and disk utility fix permissions, ran ONYX with everything on for maintenance, then copied the zoneinfo folder from Good OSX Leopard machine and overwrote other.
Tried again using terminal to set manually to America\Edmonton timezone and this time worked

If anyone knows Please advise if there is way to manually fix and how to update timezone list in systemsetup so has all entries in zoneinfo folder.

At least now working with correct timezone but weird that list is not same as folder contents.

Time Zones

My Mac clock seems to change time zones properly in nearly all ways except in putting the time stamp on files when they are created. This function seems to have gotten stuck with on Russian time (I was in Moscow at the beginning of july and had the computer set for the Moscow time zone). Even though I have reset the time zone to EDT and all clock functions look correct, the file creation times are 8 hours off. I don't quite see how this problem is related to this thread but it looks as though it ought to be connected.

the terminal fix works great

thank you. Fixed my new mac book pro that never remembered the timezone I was in.

Migrated settings from my G4

Migrated settings from my G4 laptop to a new Mac Pro workstation and had this problem.

Worked perfectly first time! Many thanks!

Another One

Just wanted to add my thanks to all the others. Your easy-to-follow instructions fixed everything right up!

FYI, there are a number of other sites trying to figure this out. Too bad they didn't just Google you. ;-)

-P

Date & Time Fix

Worked like a charm. You ROCK!

ditto to all of the above.

ditto to all of the above. You saved me a lot of time. Thanks!!!

Thank You Keith!

Oh such joy... thank you so much for posting this fix.

Please excuse me now - I have an uncontrollable urge to do the "Snoopy" dance!!!

Thanks

Thanks for such a helpful solution! I tried for a long time and could not figure this one out myself.

Thank you!

I had performed a migration from my wife's iMac G5 running 10.4 to a new iMac running 10.5 and ran into this same problem. I thought about running something like Onyx to clean out cache files but this was much faster. Many thanks!

Change time zone with command line?

Great tip, thanks! But I found this article via Google because I'm trying to find out how to set the time zone with the command line. systemsetup -settimezone America/New_York will work but systemsetup -settimezone America/Boston does not. Any thoughts?

Yes.

Yes, "America/Boston" isn't a timezone that comes with Mac OS X by default.

The system timezones are actually files, so when you type "America/New_York" you are actually specifying a relative path to a file. The relative path is in fact '/usr/share/zoneinfo'

Have a look at the file list under '/usr/share/zoneinfo/America' for all the "America" timezones that are available.

Such a great, easy fix!

Such a great, easy fix! Thanks so much!!

New mac where I transfered from an old Mac Mini

This worked like a charm. Great thorough directions.

I have a feeling it inherited the old permissions from my old box. I ended up searching for space on my old mac mini and blew away some stuff. I am sure I changed permissions on more than one occasion.

Eternal gratitude!!

Your post saved my live!! It was driving me really crazy!!

Thanks a lot, your

Thanks a lot, your instructions saved me lots of time!

Thank you!

I just want to thank you. I vaguely remember changing the umask about a year ago as a security precaution. I noticed the time was reverting to GMT before I hiked the Appalachian Trail last summer, but I didn't have the time then to figure out what I had done wrong. After I got back from the hike in November, I had forgotten about messing with the umask and was stuck with a messed up clock until today. (An interesting side note--if I logged in as root user, the time was fine. It was only when I logged in to any of my other accounts that I had GMT.)

Keep up the good work...

Thanks!

Thanks for posting this....I just ran into this problem for the first time (I'm a systems admin), and your instructions did the trick.

Thanks for the tip - another

Thanks for the tip - another migration headache goes away!

Props Keith. Worked for me.

Props Keith. Worked for me. Thank you!

Thanks! In my case, it

Thanks! In my case, it appears as though the migration assistant copied the time zone info from my old mac and gave it r/w permissions for root only.

Your fix did the trick, though.

i'm no longer going crazy

in the end, i replaced all the zoneinfo files located in /usr/share/zoneinfo
with known good ones from another Mac running 10.5 (they are not
available on the installer DVD unless you're in the US of A).

problem solved. the zonefiles themselves were corrupted at some point
perhaps it was superduper or carbon copy cloner that failed to copy the data
(the files were there, but contained no data. mostly sitting at 0 bytes).

For what it's worth, each zonefile should be 4k in size when viewed in the finder.

If you ever need these zonefiles to solve your stuck in GMT problems in Leopard 10.5.x
you can get them from here:

http://fixa.troubledmac.com/zoneinfo.zip

thanks for being here - dirtymouse

Thanks for that zip, I used

Thanks for that zip, I used carbon copy cloner and lost the files too.

A Tremendous Help

Thanks so much for posting these instructions. My brand new Mac Mini with Leopard was reverting to GMT every time I closed System Preferences. Your solution fixed that. Your willingness to share this conjures up the spirit of the early days of personal computing!

t h a n k y o u

you're instructions worked perfectly. many thanks.
~k

i'm going to go crazy and might need to move to England...

I tried the above to resolve being stuck in Greenwich

sudo defaults write /Library/Preferences/.GlobalPreferences NSUmask 18
logout/in
sudo rm -fr /etc/localtime
file was removed ok
Open Date & Time preferences to set new time zone (Sydney Australia)
Symbolic link /etc/localtime was created to: usr/share/zoneinfo/Greenwich again!

Alternatively, i started over, deleting /etc/localtime for the umpteenth time...

I re-created the symbolic link ln -s /usr/share/zonefile/Australia/Sydney /private/etc/localtime
the symbolic link stuck ok, but going back into Date & Time preferences reveal GMT again.
without making changes, the localtime symbolic link was still pointing to usr/share/zoneinfo/Australia/Sydney

i think now i'm going to go crazy and move to England, just so i'm in time with somebody.

any suggestions?

thanks - dirtymouse

Your are so smart to fix

Your are so smart to fix this annoying problem....

worked for me

Thanks

THANKS

A lot of credit to you - I got the same problem on a new MacBook with Leopard preinstalled. My hunch is that when I moved stuff from old computer with 10.4 installed, something went wrong with the user permissions....

regards,
Staffan