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

thank you!

thank you!

Awesome instructions!

Thank you so much for the step-by-step instructions to this annoying problem!

Thank YOU!! Thanks for

Thank YOU!!
Thanks for sharing your solution. I had recently migrated my boss' old Macbook to a new air and was having this problem. All calendar requests were being shifted by several hours causing some real problems.
Thanks again for sharing.

Immense Gratitude!!!!

Thanks so much for posting this solution! It was driving me crazy.

Thanks, My boss was

Thanks,

My boss was convinced I was just an idiot who didn't know how to correct the time on my Mac!

Apple Help only guessed, incorrectly, but now every thing's fine. Thanks, again.
Chi

Using XP with bootcamp in my

Using XP with bootcamp in my Macbook, I always got the wrong time (+4hrs) in my OSX menu bar, even after removing the bootcamp partition. This fixed the problem. Thanks!!

doesn't work for me ...

i get the return in terminal:

rm: /etc/localtime: is a directory

... any help? - thx

When /etc/localtime: is a directory

When /etc/localtime is a directory, in step 3a you should use the command:

sudo rm -fr /etc/localtime

 

In actual fact, the above command will work whether /etc/localtime is a file or a directory, so I will update the post to include the '-fr' option.

Thanks!

Thanks for posting this! I had the same time zone problem when I bought a new machine with Leopard on it. For some reason this page did not show up in my searches at first. I called AppleCare and they had me do everything from deleting random plists to re-installing the operating system (which I knew was overkill, but they didn't have any other ideas). Thanks to this blog post, I figured out that I needed to do was remove the /etc/localtime directory, and it was replaced by a pointer to /usr/share/zoneinfo/Canada/Eastern the next time I used system prefs to set the time zone.

Post new comment

The content of this field is kept private and will not be shown publicly.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd> <i> <b> <br> <hr>
  • Lines and paragraphs break automatically.
  • Highlight terms in this textarea.

More information about formatting options

CAPTCHA
This question is used to make sure you are a human visitor and to prevent spam submissions. It is a five digit code, if you can't work it out you can try a different code by reloading the page.
Image CAPTCHA
Copy the characters (respecting upper/lower case) from the image.