KDE-PIM-GCal Sync: GCalDaemon

This tutorial will explain how to synchronize Google Calendar and KDE-PIM, using GCalDaemon.

Part 1: What is GCalDaemon?

From the GCalDaemon web site:

GCALDaemon is an OS-independent Java program that offers two-way synchronization between Google Calendar and various iCalendar compatible calendar applications. GCALDaemon is primarily designed as a calendar synchronizer but it can also be used as a Gmail notifier, Address Book importer, Gmail terminal and RSS feed converter.

Part 2: GCalDaemon Installation Prerequisites

The first two requirements for GCalDaemon should seem obvious:

  • A Gmail account
  • An iCal-compatible calendar application (KDE-PIM in our case)

The only package dependency is Java Runtime, version 1.5 or later. Install either of the following packages (but not both):

  • sun-java6
    (Sun's Java Runtime)
  • openJDE-6-jre
    (open-source Java runtime)

Part 3: GCalDaemon Installation

These instructions are generally based on the GCalDaemon web site's installation instructions. They do require use of the command line, but aren't anything too painful.

Begin by downloading the latest Linux installation ZIP file.

Unzip this archive under the '/usr/local/sbin' directory. Assuming you downloaded the ZIP file into ~/downloads/, then:

cd /usr/local/sbin

unzip ~/downloads/gcaldaemon-linux*.zip

chmod -R g+w /usr/local/sbin/GCALDaemon

chmod 755 /usr/local/sbin/GCALDaemon/bin/*.sh

Test your setup by trying to run the password-encoding script:


If you see something like the following, then GCalDaemon is successfully installed:

Your Google password: _

We will run the password encoder script later, during configuration; so for now, hit ENTER to exit the script.

Part 4: iCalendar File Setup

We will use the file-based synchronization scheme, explained by the following diagram (provided by the GCalDaemon web site):

File-based synchronization using GCalDaemon

The key to this synchronization scheme is to have an iCal calendar file that is read/written by both GCalDaemon and KDE-PIM.

First, create the iCal file using KDE-PIM:

  1. In Kalendar view, select "Add Calendar".
  2. In the dialogue that appears, choose "Calendar in Local File".
  3. In the Resource Configuration dialogue:
    • Under "General Settings" give the calendar file a name (for this guide, we will assume the file is named "test")
    • In "Location" browse to the location you wish to store the file (this guide will assume "~/calendars/")
    • Under "Calendar Format" ensure "iCalendar" is selected

You will now see your new calendar appear in KDE-PIM. If you want, add a sample event in your calendar.

Now that the calendar file is created, we can configure GCalDaemon to synchronize this file with Google Calendar. To do so, you have two options: editing the configuration file directly, or using the Configuration Editor application.

If you are only synchronizing one calendar file, either method is equally easy. I did find, however, that configuring multiple calendar files to synchronize (I have four) was much easier using the Configuration Editor.

This guide will first explain how to edit the configuration file directly, and then how to run the Configuration Editor.

Part 5: GCalDaemon Configuration

Part 5a: Editing the Configuration File

Using the command-line instructions above, run the Password Encoder script:


At the prompt, enter your gmail password. The script will return the result of encoding the password. Take note of this result; you will need it shortly.

GCalDaemon gmail password encoder

Go to Google Calendar, and copy the iCal URL for your calendar's Private Address on the Calendar Settings page.

Google Calendar settings iCal URL

Now you are ready to edit the configuration file. Using the editor of your choice (e.g. Kate), open the /usr/local/sbin/conf/gcal-daemon.cfg file. Edit as follows:

  1. Set the 'file.enabled' property to 'true'
  2. Set the 'file.google.username' property to your Gmail address
  3. Set the 'file.google.password' property to your encoded password
  4. Set the 'file.private.ical.url' property to iCal URL, without protocol and hostname

The following screenshot details the above instructions:

GCalDaemon configuration file

Save and close the file. Everything should now be configured.

Part 5b: Configuration Editor

GCalDaemon doesn't provide a KMenu shortcut for the Configuration Editor. (You can create one, but doing so it outside the scope of this guide.) To launch the Configuration Editor, use the command-line to run the Config Editor script:


This script will run the Configuration Editor, which looks something like the following:

GCalDaemon Configuration Editor

The GCalDaemon website has a nice guide for how to configure using the Configuration Editor (note: the method I describe uses the Offline-Enabled mode). Please see the GCalDaemon guide for screenshots. Also, This guide by MakeTechEasier does a nice job of explaining how to use the Configuration Editor.

To configure:

  1. Select the second tab (HTTP Synchronizer) and disable the HTTP-based synchronizer.
  2. Select the third tab (File Synchronizer) and enable the file-based synchronizer.
  3. Enable the 'dial-up connection' mode (second checkbox on this page)
  4. Click on the 'Google Accounts' button.
  5. Register your Google Account (note: if you have already configured using the previous method, you will already see your Google account listed): Click on 'New Account', type in your Gmail address and password (twice), then click on 'Verify' button.
  6. After the verification, click on the 'OK' button in the "Verify" dialogue.
  7. Back in the File Synchronization tab, ensure the tab (at the bottom) that corresponds to your Gmail account is selected, and click on the 'New' button (bottom left). The Google Calendar Synchronization dialogue will appear. Configure as follows:
    • Google Account: Your Gmail account should be selected; if not, select it from the drop-down menu
    • Google Calendar: paste in the Private URL for your Google Calendar (which you noted previously, in Part 5a)
    • iCal File: paste in the file location for your local iCal file, used by KDE-PIM (which you created previously, in Part 4)
  8. Click "OK" to be returned to the File Synchronization tab. You will now see the file-synchronization information for your Google Calendar and local iCal file.
  9. (Note: if you want to set up multiple calendar-file synchronizations, simply repeat the above steps iin the File Synchronization tab for each calendar to by synchronized. In my case, I have four separate file synchronizations defined here.)
  10. Close the Configuration Editor.

GCalDaemon is now fully configured.

Part 6: Running GCalDaemon

Start GCALDaemon by running the "standalone-start.sh" script:


GCalDaemon is now running. You should now see your Google Calendar events in KDE-PIM. Verify the two-way synchronization by adding an event to your calendar in KDE-PIM. Depending on the polling frequency in gcal-daemon.cfg, it may take a few minutes for your new event to appear in your Google Calendar.

It would probably be a good idea to set this script to be started at session startup. (Again, doing so is outside the scope of this guide.) If this script is running, GCalDaemon will continuously poll both your Google Calendar and your local iCal file, and keep both in synch.

If, however, you don't want to leave the script running, you can use the one-time synchronize script whenever you want to synchronize your calendars. This script will run the synchronization and then exit:


That's it! Your calendars will stay perpetually synchronized (if you use the always-running script) or will synchronize on command (if you use the one-time synchronization script). Again, the setuip is more involved than using OpenSync, but in the end, maintaining synchronized calendars is easier and more secure using GCalDaemon.



3 Responses to “KDE-PIM-GCal Sync: GCalDaemon”
  1. Mike F. says:

    Just a “gotcha” that some readers may encounter…

    Although you mention installing EITHER openJDE-6-jre or sun-java6, the package names may not say either one. Mine didn’t in Debian 5. I don’t recall which package came from where…I suspect OpenOffice, LimeWire, and a few other likely perps.

    Here’s my first symptom:

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

    gave me

    INFO | GCALDaemon V1.0 beta 16 starting...
    INFO | RSS/ATOM feed converter enabled.
    INFO | Local time zone is GMT-07:00.
    INFO | HTTP server starting on port 9090...
    WARN | Set the 'http.allowed.hostnames' parameter to limit remote access.
    INFO | HTTP server started successfully.
    INFO | Start listening file /home/vladimir/.kde/share/apps/korganizer/Vladimir.ics...
    INFO | File listener started successfully.
    INFO | Offline file synchronization enabled.
    INFO | LDAP server disabled.
    INFO | Gmail notifier disabled.
    INFO | Sendmail service disabled.
    INFO | Mail terminal disabled.
    FATAL | Fatal service error!
    net.fortuna.ical4j.data.ParserException: Error at line 34: Expected [61], read [10]
    at net.fortuna.ical4j.data.CalendarParserImpl.assertToken(CalendarParserImpl.java:370)
    at net.fortuna.ical4j.data.CalendarParserImpl.parseParameter(CalendarParserImpl.java:276)
    at net.fortuna.ical4j.data.CalendarParserImpl.parseParameterList(CalendarParserImpl.java:252)
    at net.fortuna.ical4j.data.CalendarParserImpl.parseProperty(CalendarParserImpl.java:195)
    at net.fortuna.ical4j.data.CalendarParserImpl.parsePropertyList(CalendarParserImpl.java:167)
    at net.fortuna.ical4j.data.CalendarParserImpl.parseComponent(CalendarParserImpl.java:334)
    at net.fortuna.ical4j.data.CalendarParserImpl.parsePropertyList(CalendarParserImpl.java:164)
    at net.fortuna.ical4j.data.CalendarParserImpl.parse(CalendarParserImpl.java:107)
    at net.fortuna.ical4j.data.CalendarBuilder.build(CalendarBuilder.java:167)
    at net.fortuna.ical4j.data.CalendarBuilder.build(CalendarBuilder.java:149)
    at net.fortuna.ical4j.data.CalendarBuilder.build(CalendarBuilder.java:137)
    at org.gcaldaemon.core.ICalUtilities.parseCalendar(ICalUtilities.java:155)
    at org.gcaldaemon.core.Synchronizer.syncronizeNow(Synchronizer.java:215)
    at org.gcaldaemon.core.Configurator.synchronizeNow(Configurator.java:1070)
    at org.gcaldaemon.core.file.OfflineFileListener.run(OfflineFileListener.java:61)

    I recalled your advice about either openJava or SunJava.


    dpkg -l | grep java

    gave me

    ii java-common 0.30 Base of all Java packages
    ii java-gcj-compat 1.0.78-2 Java runtime environment using GIJ
    ii java-gcj-compat-headless 1.0.78-2 Java runtime environment using GIJ (headless
    ii libantlr-java 2.7.7-10 language tool for constructing recognizers,
    ii libantlr-java-gcj 2.7.7-10 language tool for constructing recognizers,
    ii libbcel-java 5.2-3 Analyze, create, and manipulate (binary) Jav
    ii libecj-java 3.3.0+0728-9 Eclipse Java compiler (library)
    ii libecj-java-gcj 3.3.0+0728-9 Eclipse Java compiler (native library)
    ii libhsqldb-java Java SQL database engine
    ii libhsqldb-java-gcj Java SQL database engine (native code)
    ii libjaxp1.3-java 1.3.04-3 Java XML parser and transformer APIs (DOM, S
    ii libjaxp1.3-java-gcj 1.3.04-3 Java XML parser and transformer APIs (DOM, S
    ii libjline-java 0.9.94-1 Java library for handling console input
    ii liblog4j1.2-java 1.2.15-4 Logging library for java
    ii libmx4j-java 3.0.2-4 An open source implementation of the JMX(TM)
    ii libregexp-java 1.4-5 regular expression library for Java
    ii libservlet2.4-java 5.0.30-8 Servlet 2.4 and JSP 2.0 Java classes and doc
    ii libxalan2-java 2.7.1-2 XSL Transformations (XSLT) processor in Java
    ii libxalan2-java-gcj 2.7.1-2 XSL Transformations (XSLT) processor in Java
    ii libxerces2-java 2.9.1-2+lenny1 Validating XML parser for Java with DOM leve
    ii libxerces2-java-gcj 2.9.1-2+lenny1 Validating XML parser for Java with DOM leve
    ii openoffice.org-java-common 1:2.4.1+dfsg-1+lenny6 OpenOffice.org office suite Java support arc
    ii sun-java6-bin 6-12-1 Sun Java(TM) Runtime Environment (JRE) 6 (ar
    ii sun-java6-fonts 6-12-1 Lucida TrueType fonts (from the Sun JRE)
    ii sun-java6-jdk 6-12-1 Sun Java(TM) Development Kit (JDK) 6
    ii sun-java6-jre 6-12-1 Sun Java(TM) Runtime Environment (JRE) 6 (ar
    ii sun-java6-plugin 6-12-1 The Java(TM) Plug-in, Java SE 6

    Since I’m less worried about morally pure open source than I am about stuff working right, I removed the gcj-compat java stuff


    apt-get remove java-gcj-compat-headless

    which gave me

    Removing openoffice.org-gcj ...
    Removing java-gcj-compat ...
    Removing java-gcj-compat-headless ...

    Now things are syncing nicely with my Google Calendar, OpenOffice doesn’t seem any worse for the ear, and I hope to get my contact lists all synced in no time.


  2. Chip Bennett says:

    Glad it worked for you, and thanks for the additional information!

    I plan to do an update in the near future, once Kontact is a bit more polished in KDE4 (I’m having too many issues with Kontact in KDE SC 4.4.3 to try yet. But, we’re promised improvements in a KDE SC 4.5 dot-release later this summer – so I’ll aim for an update then, hopefully.)

  3. Mike F. says:

    Yes. I agree entirely about KDE4’s PIM. Difficulty with PIM is the entire reason I reverted back to KDE 3.5.x

    One other symptom of conflicting Java that I forgot to mention.

    With both openJava and SunJava installed, the GUI config utility would hang after attempting to display the progress bar. Removing the additional Java fixed that, too.

Leave a Reply

Your email address will not be published. Required fields are marked *

Click to view/hide
Click to view/hide
Post Formats
Click to view/hide