Calendar Synchronization, continued.

A few days ago I posted about using Spanning Sync and Proximity to synchronize iCal, Google Calendar and my cell phone (a k790, although any phone supported by iSync should work).

It turns out there is a free alternative to Spanning Sync called GCALDaemon, which is a bit more work to get running but a decent alternative if you don’t want to pay for Spanning Sync.

GCALDaemon is, unfortunately, a Java application, which makes me a bit uncomfortable running it all the time on my Mac. My experience with doing development using Eclipse and Tomcat is that my machine would need to be rebooted almost exactly every 7 days or it would start behaving erratically. I have no idea if this is related to the Java runtime or not, but it was still less than ideal having GCALDaemon run in the background 24/7.

Luckily, for my purposes — since I wasn’t really concerned with keeping Google Calendar and iCal perfectly in sync — I could launch GCALDaemon in “standalone” mode using Proximity and sync all my devices at the same time. To use this setup instead of Spanning Sync, do the following:

  1. Install GCALDaemon according to the instructions on their site. Stop without setting it up as a service.
  2. Setup GCALDaemon to sync your iCal calendars with Google Calendar by following the instructions. There is a simpler method for determining which corestorage.ics file is mapped to your local calendars: next to it you will find an “info.plist” file which contains the name of the calendar.
  3. GCALDaemon has a feature which will run some AppleScript after each update. This is necessary if you keep iCal running all the time, as iCal does not check for changes to the ics file except on load. The default installation contains some code for switching the calendar view, but on my machine this failed to reload the calendars. The only solution I could make work was restarting iCal. Change the contents of GCALDaemon/bin/reload-calendar.scpt to:
    tell application "iCal" save quit delay 2 end tell tell application "iCal" to activate
    and ensure that you have turned on the Reload Calendar script option in the configuration editor.
  4. Now you can execute the full synchronization from the Entering Proximity script by adding the following line:
    do shell script "/usr/local/sbin/GCALDaemon/bin/sync-now.sh"

The synchronization process will now take a few moments longer, but it’s worthwhile if you’re uncomfortable running a GCALDaemon as a service. It also solves the issue of refreshing iCal’s calendars after each update.