Poor man’s MobileMe, sync Address Book with Google without iPod

Update: This functionality is built into Snow Leopard (10.6).  I’ll leave this document up for posterity and users of the warmer Leopard (10.5).

Mac OS X Leopard lets you sync your Address Book with “cloud” address books like MobileMe and Yahoo.  I want to sync with my Google address book though because I use Gmail.  Connecting an iPhone to your Mac will enable another checkbox in the Address Book preferences to sync with Google instead.  This post describes how to overcome two limitations of that:

1) an iPhone is required to activate the feature

2) it only syncs when you sync your iPhone

Activating without an iPhone

To make the sync system think you have an iPhone, you need to modify your com.apple.iPod.plist file. Lifehacker has a good description of how to modify the plist. This makes the syncing system think your iPod is one that supports syncing.
But what if you don’t have an iPod? A comment by Eric provides a great hack. Here’s a simple command you can run in the Terminal to accomplish it:

cat > ~/Library/Preferences/com.apple.iPod.plist
{
	Devices = {
		"red-herring" = {
			"Family ID" = 10001;
		};
	};
}
^D # type Control-D to end the input

Now your go to Preferences in Address Book and check the Synchronize with Google option and enter your account info. You’ve got the sync channel set up.

Syncing

A detailed article at Zaphu.com has instructions to make your first sync. Those didn’t work for me.
This Google Mobile Help discussion thread and in particular user mshick build on those instructions with more advanced hacks. Here are the commands to run in the Terminal to get it going,

# set your Google account credentials
GOOGLEACCOUNT=user@gmail.com
GOOGLEPASSWORD=yourpassword
# change the Google sync client type to server
sudo defaults write /System/Library/PrivateFrameworks/GoogleContactSync.framework/Resources/ClientDescription Type 'server'
# restore the permissions on the plist file:
sudo chmod 644 /System/Library/PrivateFrameworks/GoogleContactSync.framework/Resources/ClientDescription.plist
# run a sync with Google
/System/Library/PrivateFrameworks/GoogleContactSync.framework/Versions/A/Resources/gconsync --sync gconclid --register 1 --username $GOOGLEACCOUNT --password $GOOGLEPASSWORD --syncmode fast

After a pause you should get a dialog box asking you to confirm the changes to your address book (assuming more than 5% of your address book changes). You’ve successfully synced and you can now make it work with a simple menu item.

Open iSync and open Preferences. Click “Show status in menu bar” and should now have a sync icon in your menu bar with an item, Sync Now. Choose that whenever you want to sync. (Graphic instructions are in the Zaphu article.)

If you want to have your Mac sync regularly you can set up a regular script to run /System/Library/PrivateFrameworks/GoogleContactSync.framework/Versions/A/Resources/gconsync --sync gconclid --syncmode fast. You don’t have to include the register argument since it’s already registered and you don’t have to include your username or password since they’re now stored in com.google.GoogleContactSync.plist and your Mac keychain, as described here. You can set the command to run regularly using cron or launchd. mschick suggests Lingon to make this easier.

Thanks everyone for figuring this out.

Leave a Reply

  • Subscribe

    Subscribe to all posts by feed.
  • Enter your email address to subscribe to this blog and receive notifications of new posts by email.

    Join 3 other subscribers