Finally: Full Google-Calendar Sync with GCALDaemon

Since I use Google Calendar I was looking for an elegant and logical solution to keep it synchronized with my local calendar application (which was to be found) – biderectional. I guess soon this will become a standard feature, however by now it is not. Today I stumbled upon what I was looking for, and once again this is possible due to the *nix-Core of OSX.

Update: Flawless Sync with CalDav

Sync without any tweaking around is working perfectly with Google’s CalDav. Check out how to set it up here and enjoy flawless syncronization.

Big thanks go out to an anonymous commenter!

Update for OSX 10.5 Leopard

As things are by now it seems that Leopard stores iCal’s files kind of unusual and without extra PERL-Scripts and other humpty-tumpty hacking there’s no way of getting GCALDaemon to properly work with it. Therefore this solution is plain not working and not recommended for Leopard. I’ve hear that Plaxo Online can do all the syncing, but haven’t tried myself.

But don’t mind that, in clear words what this solution does is: Whatever calendar program you’re using, as long as it is based on .ical-files this handy little tool will run in the background and then, every few minutes, will synchronize this file with your google calendar. That way it’s totally independent from the calendar application and basically you can use whatever program suits your needs. You install this tool only once and then, forever, can sync any local ical file with any online google calender – bidirectional. The following instructions are for setting the thing up with Apple’s iCal, but other programs are pretty much the same.

GCALDaemon

A great and simple program, doing one thing: It synchronizes your remote google calendar with your local .ical-sourcefile, and vice versa. That’s not just great because it simply works, it also brings along two major features: The local calendar file will keep the calendar 100% available offline plus it’s no problem switching to any other program that’s using the ical – format.

However since we’re talking about an unix-application here the installation requires a little Terminal-fiddling, but not as much as one would expect. The following tutorial will make you a happy synchronized person and I promise things are easy, because I’ll use the finder instead of the terminal as much as possible. Now for the process:

  1. Download GCALDaemon
  2. Unzip to the correct directory
  3. Create your calendars
  4. Configure with the built-in GUI
  5. Install as startup-application

1: Downloading GCALDaemon

That one’s easy. Click the headline. Download the Linux/Mac – compatible .zip-archive. That’s it. don’t bother with the installation instructions, we’ll get that done in a second

2. Unzip to the correct directory

Unzip the archive to your desktop. In the now new directory you’ll find another directory: GCALDaemon. We’ll need this in a second. Now, first time for some Finder trickery. Click on an empty place on your desktop so the finder is the active application. Now either press Command + Shift + G or go to the menu bar and select “Go To > Folder …”. A dialogue box will pop up. Enter, and enter exactly:

  1. /usr/local

If everything’s right you now should have a Finder window showing the folders: /lib and /sbin. If the latter doesn’t exist, create it now from within the Finder. You’ll probably have to identify as administrator, as those directories can be write-protected. That’s ok, enter your password, create the folder and get in. Congratulations, you’re now in /usr/local/sbin. On with the stuff.

Copy the folder GCALDaemon from your desktop to /usr/local/sbin. Once again it’s possible the system will ask you to identify – do that (do that whenever it happens during the installation process).

3. Create your calendars

If you haven’t already done that, go to iCal now and create your calendars as normal local calendars. If you just wanna try this you can also use the default calendar that’s already set up, repeating step 4 you can easily add more calendars whenever you feel like.

4. Configure with the built-in GUI

This one was listed at the end of the manual installation instructions and I kind of hated the GCALDaemon-Guys for a few minutes there. But you don’t have to suffer, but can profit from my findings. Now for the first of two terminal commands (you’ll need no more than those two, I promise). Open a Terminal window (Applications > Utilities > Terminal). Now type, and once again type exactly, the following:

  1. /usr/local/sbin/GCALDaemon/bin/config-editor.sh

Execute the command by hitting the Enter. After a second or so a window will pop up. Ignore the whole settings-stuff and go to “File synchronizer”. Click the first line: “Enable file-based calendar synchronizer” until it’s checked green. Do the same with “Enable dial-up connection and/or use PDA synchronizer ['offline-enabled' mode]” (the latter is theoretically unnecessary when you’re on a constantly connected workstation, but the sync-mode is more flexible and there’s no disadvantages whatsoever, so just check if if you don’t have a good reason not to). The “Google Calendar polling interval” is the interval GCALDaemon uses to synchronize your online-calendar. The 15 minutes setting should be fine, so if you’re not excessively switching between browser and iCal access you can leave this alone.

Now for the real part. On the bottom right there’s a button “Google Accounts”. Click it, choose New Account, enter your mail and enter your password twice. Check with verify. If everything’s fine click ok. The next interesting button is the “New”-Button, just three steps left from the “Google Accounts”-one. Click it, select the remote calendar you want to synchronize and the local Calendar you want it to be synchronized with. Close the application and if you’re asked to save your changes click “Ok”. Tada, Magic done. You can repeat this step whenever you need to add or edit a calendar.

5. Install as startup-application – THANK YOU BUILD CHIMP

This is a little bit tricky, but if you follow the steps below you should be fine. Credits for that all go to Build Chimp. Now we need to tell OS X to execute this file on startup. This is being done with a .plist file. Open the editor (Applications > Utilities > Editor). Don’t use TextEdit, you’ll need the Editor! Create a new file, copy the following code – exactly – to the editor:

EnvironmentVariables
  1.  
  2. JAVA_HOME
  3. /System/Frameworks/JavaVM.framework/Versions/1.5
  4.  
  5. Label
  6. net.sf.gcald
  7. OnDemand
  8.  
  9. ProgramArguments
  10.  
  11. /usr/local/sbin/GCALDaemon/bin/standalone-start.sh
  12.  
  13. RunAtLoad
  14.  
  15. ServiceDescription
  16. GCALDaemon
  17. StandardErrorPath
  18. /usr/local/sbin/GCALDaemon/log/launchd.stderr
  19. StandardOutPath
  20. /usr/local/sbin/GCALDaemon/log/launchd.stdout

Easy. Now save the file to your desktop with the name:

net.sf.gcald.plist

Watch out that editor doesn’t add a file extension. Next we’ll have to move it to it’s final destination:

/Library/LaunchDaemons

Go to your desktop, double-click your harddrive (“Macintosh HD”, or “OSX”, or whatever yours is called). Select the folder “Library”, then select “LaunchDaemons”. There’s a good chance the folder is empty, but never mind, that’s ok. Now move the file net.sf.gcald.plist from the desktop to this folder (Indentification might be needed once more). We’re almost done.

Finally open a Terminal window again and type in the following line:

  1. sudo launchctl load -w /Library/LaunchDaemons/net.sf.gcald.plist

Hit Enter. You’ll be asked for your password. As you enter it the Terminal will not reflect your input, no stars, no nothing, that’s normal. Just enter your password and finish with Enter.

Congratulations, you successfully installed full iCal / Google-Calendar synchronization.

If you’re fine with the terminal you could now start the tool manually with the line

  1. /usr/local/sbin/GCALDaemon/bin/standalone-start.sh

or initialize a first sync with

  1. /usr/local/sbin/GCALDaemon/bin/sync-now.sh

Otherwise you’ll have to logout and back in. Remember that the synchronization-interval is 15 minutes and the data transfer might take some time, but for me it by now works perfectly fine and I really enjoy the synced calendaring.