Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

Synchronize iCal on multiple machines via WebDAV Apps
This is a simple hack, and I can't believe it took me months to realize some of iCal's sync problems can be solved with a quick Unix symlink. While iCal can publish-to or subscribe-to a calendar, it can never do both at the same time. For most of us using WebDAV services on our Apache servers, that creates the problem of synchronizing our calendars across multiple machines. iCal will be happy to update its .ics files on a server, but it never reads back from those files when it loads.

The solution? Symbolic link the default calendar storage *folder* to your WebDAV server (not the individual .ics files, because iCal overwrites those). This method will insure that iCal will read the symlinks every time when its loaded, and write-to the symlinks every time it is closed. The idea came from the iCal weblog, so this is nothing new, although I'm shocked that more people do not use this method.

Instructions:
  1. Close iCal if it is running by hitting Command-Q.
  2. Upload your .ICS calendar files from ~LibraryCalendars to a folder on your WebDAV server (ie, a folder called "Calendars")
  3. Back up your .ICS calendar files from ~LibraryCalendars just in case anything goes wrong.
  4. Load up Terminal, and delete your iCal calendar folder by typing rm -rf ~LibraryCalendars -- but before you do so, make sure you've performed the previous step to create a backup!
  5. Connect to the WebDAV service through the Finder by hitting Command-K (Go: Connect to Server).
  6. Enter the web address of the WebDAV server you are trying to connect to. For example, your WebDAV document folder might be at the address http://www.myexample.com/mydocuments
  7. Once connected to your WebDAV server, load up Terminal again and navigate to ~/Library/ by typing cd ~/Library.
  8. Make a symbolic link between your WebDAV server folder and the 'Calendars' folder (that you deleted earlier) on the local machine by typing ln -s /Volumes/mydocuments/Calendars.
The last step is crucial, as it links the Calendars folder that iCal reads its .ICS files from to the remote server that actually has the files stored there. iCal treats this 'symbolic' folder just as it would a normal folder. So what's the 'hack'? Well, not much of one. We're just fooling iCal into thinking the files it's reading and writing are stored on the local machine, not on a remote machine.

The only warning I have to offer is that make sure that you are already connected to your WebDAV server before launching iCal, or I'm sure nothing will appear in your calendar. Or worse, it's possible that iCal will create a new 'Calendars' folder and waste all your hard work symlinking it.

[robg adds: I haven't tested this one...]
    •    
  • Currently 2.50 / 5
  You rated: 2 / 5 (6 votes cast)
 
[47,974 views]  

Synchronize iCal on multiple machines via WebDAV | 16 comments | Create New Account
Click here to return to the 'Synchronize iCal on multiple machines via WebDAV' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Synchronize iCal on multiple machines via WebDAV
Authored by: Brock Lee on Apr 15, '05 12:44:40PM
There are some significant errors in the post. At the very least, every reference to
~LibraryCalendars
should be
~/Library/Calendars
.

[ Reply to This | # ]
Synchronize iCal on multiple machines via WebDAV
Authored by: archimed on Apr 18, '05 12:23:04PM

My apologies! I didn't catch the typo when I wrote the hint. Thanks for the input.



[ Reply to This | # ]
Synchronize iCal on multiple machines via WebDAV
Authored by: vocaro on Apr 15, '05 05:27:20PM

On a side note, I understand that the new iCal 2 release in Mac OS X 10.4 provides native support for reading and writing any .ics file. So hopefully with Tiger we won't need to jump through hoops like this...



[ Reply to This | # ]
This hint is guaranteed to cause problems
Authored by: porkchop_d_clown on Apr 15, '05 05:49:26PM

I don't think iCal was written with the idea that two copies might have the same calendar file open at the same time.

Why is this a problem? Because it means that if two users *do* open the same ics file at the same time, one of them is going to lose their changes.

Consider:

A opens cal.ics.
B opens cal.ics
A closes cal.ics
B closes cal.ics.

When A opens cal.ics again, they are going to find that all their changes are gone.

---
Everyone loves a clown, but no one will lend him money!



[ Reply to This | # ]
This hint is guaranteed to cause problems
Authored by: meikokun on Apr 16, '05 09:30:22AM

are you sure that is the case? What happens when you write data to a file and it is saved on the fly, without needing to save on closing? As long as no two people write to the same point in the data file (or perhaps in this case, an appointment time perhaps) the data from both inputs will be saved simultaneously. I'm sure that even the same appointment-simultaneous modification hurdle shouldn't be too tricky to overcome for some wiley developer. In point of fact, ical seems to do on the fly saving right now - enter some data into it, immediately force quit then reopen the app, and your data is right there.
plenty of other apps do that, and that's my number one reason for using fishpad as a notepad replacement (ok, it number two - instant launching is number one)
Or am I missing something?
Cheers
dd



[ Reply to This | # ]
This hint is guaranteed to cause problems
Authored by: Tom Robinson on Apr 16, '05 04:40:14PM

Just because iCal regularly writes changes to the ics files doesn't mean it re-reads them constantly too--it might be working on a copy in memory and just writing out changes--which means the point raised by porkchop_d_clown is still valid.



[ Reply to This | # ]
This hint is guaranteed to cause problems
Authored by: meikokun on Apr 17, '05 05:44:06AM

fair point - but it cannot be out of the realms of possibility to have ical check a calendar more than the one-time-on-opening scenario. As I recall, it does this with subscribed-to calendars in any case (I haven't used one recently so working from foggy memory here) but if ical can manually be asked to check a remote calendar, and update the local contents as a result - through the 'refresh' option - then how tricky can it be to at least fudge the process and make it applescriptable to any refresh speed you choose (or cron-job the action)? Better still of course is to give a possible default refresh option that's quicker than the current fifteen minutes within the app itself.
In summary, it's clear if what you say is true, that ical doesn't read on-the-fly that it's possible to make it read more often than once on opening.
It's also clear that it currently saves as you type.
The only thing that seems to be stopping apple from implementing this must be financial - hey, it worked for me; several years after being disguted that apple made .mac a paid-for service (and me losing use of my nice .mac mail addy in the process), I've taken out a .mac subscription with the sole purpose of syncing my laptop and several office computers. The buggers at apple, with their evil capitalist ways! ;)

thinking about it, I believe there is a shareware app which does something like this, I'm off to have a peek.
Cheers
dd



[ Reply to This | # ]
This hint is guaranteed to cause problems
Authored by: meikokun on Apr 17, '05 05:18:17PM

here's the app; http://ww2.unime.it/flr/isyncal/en/how_sync.html
that's the 'here comes the science' bit. It would appear you are correct as far as this app is concerned, so the quest continues....



[ Reply to This | # ]
This hint is guaranteed to cause problems
Authored by: archimed on Apr 18, '05 12:25:15PM

Yes, you're absolutely right, and I should have noted this in the hint. iCal will *definitely* over-write changes if this hint is used for multi-user sharing. I never meant to suggest this would useful for multiple users, only simply multiple *machines*. Thanks for pointing out this error.



[ Reply to This | # ]
Synchronize iCal on multiple machines via WebDAV
Authored by: danieleprocida on Apr 16, '05 06:21:36PM

This suggestion might be useful for someone who has two Macs, and would like to have a single calendar between them, so long as she quits iCal on one before starting it up on the other. This is because - so far as I have been able to ascertain - iCal only reads a calendar file when it first opens it, even though it writes changes every time they are made.

So, this technique unfortunately won't help two people who want to share a calendar. Any changes that are made to the calendar by one user will be overwritten by the other user when the latter quits iCal.

I don't think there is going to be a way around this until either someone works out how to emulate a .Mac server for iSync purposes, or (as is promised for Tiger) Apple make it possible to share calendars without using .Mac.



[ Reply to This | # ]
Synchronize iCal on multiple machines via WebDAV
Authored by: spudnik187 on Apr 18, '05 06:37:45PM

I covered this in my blog at http://spudnik187.blogspot.com some time ago. As has been mentioned, this does not allow for two users to edit a file simultaneously. I use it to create/edit events on my PC at work using Thunderbird. Those changes are written to my WebDAV server running on my iMac. iCal then reads that file from the same WebDAV folder and does its thing. Works well for my needs, but won't do the same for everyone.



[ Reply to This | # ]
UPDATE FOR TIGER: Synchronize iCal 2.x on multiple machines via WebDAV
Authored by: archimed on Jun 14, '05 09:37:41AM
This is essentially the same hint, updated to reflect the pathname changes that Tiger requires for iCal to function correctly.

Instructions:

1. Close iCal if it is running by hitting Command-Q.
2. Upload your .calendar folders from
~Library/Application Support/iCal/Sources
to a folder on your WebDAV server (ie, a folder called "Sources")
3. Back up your .calendar folders from
~Library/Application Support/iCal/Sources 
just in case anything goes wrong.
4. Load up Terminal, and delete your iCal calendar folder by typing
rm -rf ~Library/Application Support/iCal/Sources
-- but before you do so, make sure you've performed the previous step to create a backup!
5. Connect to the WebDAV service through the Finder by hitting
Command-K
(Go: Connect to Server).
6. Enter the web address of the WebDAV server you are trying to connect to. For example, your WebDAV document folder might be at the address
http://www.myexample.com/mydocuments

7. Once connected to your WebDAV server, load up Terminal again and navigate to ~/Library by typing
cd ~/Library.

8. Make a symbolic link between your WebDAV server folder and the 'Sources' folder (that you deleted earlier) on the local machine by typing
ln -s /Volumes/mydocuments/Sources Sources


The last step is crucial, as it links the Calendars folder that iCal reads its .ICS files from to the remote server that actually has the files stored there. iCal treats this 'symbolic' folder just as it would a normal folder. So what's the 'hack'? Well, not much of one. We're just fooling iCal into thinking the files it's reading and writing are stored on the local machine, not on a remote machine.

The only warning I have to offer is that make sure that you are already connected to your WebDAV server before launching iCal, or I'm sure nothing will appear in your calendar. Or worse, it's possible that iCal will create a new 'Calendars' folder and waste all your hard work symlinking it. New Note: iCal will just load up a blank calendar if you've forgotten to connect to your WebDAV server before loading it

[ Reply to This | # ]
UPDATE FOR TIGER: Synchronize iCal 2.x on multiple machines via WebDAV
Authored by: jeffrey1681 on Apr 14, '06 12:55:23PM

I tried following your instructions, but despite the symlink seeming to be set up correctly, when I open iCal each of the calendars has a red exclamation point next to it. If I click on one it gives me an error message that iCal was unable to load the file. The webDAV directory seems to be working fine and the symlink points to the right place when I follow it. Anyone have any ideas what happened?



[ Reply to This | # ]
UPDATE FOR TIGER: Synchronize iCal 2.x on multiple machines via WebDAV
Authored by: archimed on Apr 16, '06 06:40:41PM

Sorry - I don't have any suggestions. My iCal is still working with this hack.
Perhaps ensure that you're using the latest version of Mail.app, OS X, and that you followed the instructions for Tiger (and not Panther)?

Good luck!



[ Reply to This | # ]
UPDATE FOR TIGER: Synchronize iCal 2.x on multiple machines via WebDAV
Authored by: Nikolay Komarov on Apr 20, '06 06:48:04AM

If it tells so then it's true.
Try to open Terminal and to copy the calendar file using this symlink to somewhere else. The problem could be if: there are not enough permissions in your local filesystem (try ls -al, make sure you have 'r' flags for owner and, maybe, group), in the filesystem of the website you try to reach (check it via web-browser or via ftp-client by lookuing up these permissions) or maybe your Mac losts connection after you open that location, or you log out or... anything...
Check everything SOON AFTER you see this error message, not before.



[ Reply to This | # ]
Synchronize iCal on multiple machines via WebDAV
Authored by: bnj on Apr 05, '06 01:34:53AM

[quote]The only warning I have to offer is that make sure that you are already connected to your WebDAV server before launching iCal,[/quote]

is it possible to automate the task of connecting to my webdav server at each login using automator?



[ Reply to This | # ]