Snow Leopard and Close to Instant Gmail Contact Sync

Posted: August 31st, 2009 | Author: Remi | Filed under: Cocoa, OS X, iPhone | 1 Comment »

I’m sure many of you are aware that Apple has just released their newest OS X update called Snow Leopard, I was lucky enough to get my hands on a copy already. One very interesting feature of this update is the support for syncing your contacts in Address Book.app with Gmail’s contacts. Through Gmail, you can already sync your contacts to your iPhone thanks to Google Sync‘s MS Exchange servers. With the these two services combined you can have your contacts on your phone synced to your computer and vice-versa fairly instantly without MobileMe. The problem I was having was that this service didn’t do quite instant enough for my taste, here’s how you enable the sync, and how you can tweak it to make it even closer to instant.

First enable Gmail Contacts sync in Address Book by clicking Address Book > Preferences… > Accounts. Then click “On My Mac”, and then check the box next to synchronize with Google. Enabling Google Sync in Address Book in Snow Leopard After enabling it you will be prompted for your Gmail username and password. Then you should see a sync icon in your status bar. This lets you manually force a sync with google by clicking “sync now.” When it syncs you will probably have to resolve some ‘sync issues’ (basically deciding which contact is correct, the Gmail or Address Book version.)
Snow Leopard Sync Menu
If this icon annoys you, just hold down the apple key and drag it out of the bar to remove it, to put it back you can enable it in iSync.app’s preferences.

Now to tweak it. Your computer syncs your contacts in a job in that runs through a process called launchd (For those of you that don’t know, in Tiger and newer, launchd takes the job of cron on normal unix systems.) By default this process runs only once every hour, we are going to try and tweak this. To easily edit your loaded jobs, download Lingon from here http://sourceforge.net/projects/lingon/files/. Open up Lingon, on the left under ‘My Agents’ you should see ‘com.google.GoogleContactSyncAgent.’ Click this, and you here you are able to change it from running every hour to as little time as every second (although I don’t recommend this AT ALL.) Just adjust this setting to a shorter time period to speed it up. The real trick here though is that you can set something called a watch file/directory. This lets the process run when that file/directory has been modified. To make the sync run whenever you change one of your contacts you should just fill in under “Run when this file is modified” this file /Users/remi/Library/Application Support/AddressBook/AddressBook-v22.abcddb This file is your address book database, so hence it runs when you update the database. Lingon Editing Snow Leopard Google Sync Agent Remember that this makes your contacts instantly updated from your computer to google, but no the other way around. The frequency that the contacts come into your computer from google is determined by the “run it every” setting. I do not know why apple did not have the file set to watch the address book database to begin with, so I’m not sure if there are any adverse effects, but there has been none that I have experienced so far. Once you are finished editing the job, hit save, then log out and back in or restart for it to take effect. To try it out just edit one of your contacts in Address Book.app and see the update automatically appear on Gmail, and if you iPhone is synced to Gmail, then right to your iPhone.

Please post a comment if you have problems with this method, good luck everyone!


One Comment on “Snow Leopard and Close to Instant Gmail Contact Sync”

  1. 1 Carlos Rendon said at 5:48 am on April 17th, 2010:

    This is extremely useful, will try it out. It annoys me not to have it sync immediately like exchange does. Thanks for posting this!


Leave a Reply