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

Edit and sync iCal calendars on multiple machines Network
The problem I had was that I wanted to be able to access and edit my iCal calendars on multiple computers, without having to sign up to .Mac (being a cheapskate and all). Currently in iCal, if you publish from two different computers to one calendar file, the changes made by one will not be shown in the other. These steps should be made on all computers.
  1. Backup your ~/Library/Calendars directory.
  2. Publish your calendars on the web. This can either be hosted on your own computer (follow the excellent guide here), or to an external website such as iCal exchange, which is free. Make sure that the calendars you wish to share are published in iCal.
  3. Download and install Sunbird. Sunbird is the standalone Mozilla calendar, and the clever thing about it is that it allows one to both subscribe to and publish to the same calendar via WebDAV (iCal only allows you to do one or the other). It uses the same format as iCal. The reason that I do not use it instead of iCal is that I think it looks ugly at the moment. Warning! Sunbird is beta software at the moment, but seems stable enough to me.
  4. For each of your iCal calendars, set up a corresponding calendar in Sunbird:
    1. Goto File -> New Calendar file.
    2. Enter the file location. Browse to ~/Library/Calendars and pick the corresponding calendar file used in iCal. It will ask you whether you want to overwrite the file, just say yes (remember it is stored on the web).
    3. Enter the remote server URL. This is the URL that you have published your calendar to e.g. http://www.example.com/ical/Home.ics. It is important that this step is followed or it will not work!
    4. I also allow automatic publishing and pick a colour, but these are not essential.
  5. Now every time you switch computers, before you start iCal, simply load Sunbird, press Command-R to reload the calendars from the web, and quit. This basically overwrites the iCal calendars with the up-to-date copy that is on the web.
So basically, Sunbird is used to sync the web copy with the local copy. Note that you should not run the two programs at once, as both are using the same files so the programs could get confused. I know this is pretty clunky, so as an alternative, here is a bash script that can be run instead of opening iCal (wget needs to be installed (it's available via Fink), but Sunbird is not needed):
#!/bin/bash
USER=user
PASSWORD=passwd
URL=http://example.ac.uk/ical/

#Put your calendar names the next line:
for i in Home Work Birthdays
do
  wget --http-user=$USER \
  --http-passwd=$PASSWORD $URL$i.ics -O ~/Library/Calendars/$i.ics 
done

open -a iCal.app
exit
[robg adds: I haven't tested this one...]
    •    
  • Currently 3.00 / 5
  You rated: 4 / 5 (7 votes cast)
 
[97,862 views]  

Edit and sync iCal calendars on multiple machines | 17 comments | Create New Account
Click here to return to the 'Edit and sync iCal calendars on multiple machines' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Edit and sync iCal calendars on multiple machines
Authored by: swbuehler on Jan 27, '05 10:06:29AM

You could also use curl (which is built into OS X) instead of wget:


curl \
   -u $USER:$PASSWORD \
   $URL$i.ics -o ~/Library/Calendars/$i.ics


[ Reply to This | # ]
Edit and sync iCal calendars on multiple machines
Authored by: spudnik187 on Feb 07, '05 09:53:12PM

I'm doing something similar. I found a way to sync iCal and Subird remotely without having to use Sunbird on the iCal machine (hope that makes sense). I've documented it on my blog at http://spudnik187.blogspot.com

Feel free to check it out and comment. I haven't seen this particular solution anywhere else, but let me know if it's already been done.



[ Reply to This | # ]
Edit and sync iCal calendars on multiple machines
Authored by: baokhangnn on Jan 27, '05 11:16:07AM

Have you looked at isyncal? You can sync multiple calendars between mutliple computer/users etc over AFP, WebDAV, etc. You only need to turn on file sharing on your computer! No setting up of WebDAV, Web Server, or remote hosting!



[ Reply to This | # ]
Edit and sync iCal calendars on multiple machines
Authored by: danielsbrewer on Jan 27, '05 11:54:07AM

No I haven't looked at isyncal, looks interesting. I use webdav to allow me to use phpicalendar (http://www.gregwestin.com/computers.php for an installation guide) too, so using webdav has added benefits!



[ Reply to This | # ]
Edit and sync iCal calendars on multiple machines
Authored by: bluehz on Jan 27, '05 12:31:22PM

You might could work out something along the lines of using md5 to check the file and compare with what you have locally and then copy if needed... something along the lines of this will compute a checksum for a remote file:

curl $url | md5

...you would then compare with local file and if they don't match you know you have to sync.



[ Reply to This | # ]
Edit and sync iCal calendars on multiple machines
Authored by: ThereSkippy on Jan 27, '05 12:39:36PM

This actually takes advantedge of a bug in iCal which makes it impossible to seamlessly share calendars between Sunbird and iCal: Sunbird _updates_ the calendar data, whereas iCal just rewrites it. If iCal would do it properly you could do cross-platform calendar sharing between the two.



[ Reply to This | # ]
ical is portable?! what about address book?
Authored by: zojas on Jan 27, '05 03:03:34PM

I feel like an idiot! I've been grabbing the calendar files from my ipod (which iSync put there) and trying to find a way to 'fix' the file to be able to access it in Linux. turns out all I needed to do is copy the standard ical files from ~/Library/Calendar/ over to my linux box! korganizer opens the ical files with no problems too.

then there's address book. I can translate the utf-16 version of the address book file iSync puts on my ipod to something kaddressbook can understand, using the 'recode' utility:

cat iSync.vcf |recode -v UTF-16..UTF8 > contacts_recoded.vcf

but now I'm wondering if maybe there is a simpler way for the address book too? besides, when I import the 'contacts_recoded.vcf' file into kaddressbook, it doesn't pick up the street address, even though the street addresses are in the vcf file. does anybody have any more experience making the address book portable?



[ Reply to This | # ]
ical is portable?! what about address book?
Authored by: zojas on Jan 27, '05 04:30:16PM

I'll answer my own question. simply exporting all contacts from AddressBook as vcard 2.1 results in a perfect import into kaddressbook. the default of using vcard 3.0 resulted in some fields not being imported probably by kaddressbook.



[ Reply to This | # ]
Edit and sync iCal calendars on multiple machines
Authored by: tsaar on Jan 28, '05 04:41:01AM

Or you could get a Palm device & hotsync it with iSync at the two computers. If you ever needed an exuse to buy one..:)

I'm happily (well, almost, there's the odd conflict) syncing iCal with Lotus Notes (at work) this way.

Then I use PHPicalendar (http://sourceforge.net/projects/phpicalendar/) to publish the calendar as a nice looking webpage....



[ Reply to This | # ]
Edit and sync iCal calendars on multiple machines
Authored by: mortmer on Mar 03, '05 01:11:57PM

You can make the script clickable by using the SetFile utility and entering the following -

/Developer/Applications/SetFile -t APPL (scriptname.sh)



[ Reply to This | # ]
Edit and sync iCal calendars on multiple machines
Authored by: elviscat on Mar 09, '05 07:57:39AM

Hi
i'm trying to do this but am a bit unsure of which program does the 'publishing'.
at the moment i have my 'main' calendar on my work g4, and my laptop at home 'subscribes', but i'd like to have it able to add to the main calendars.

Do you leave ical 'publishing' on both computers ?
or do you get sunbird to 'publish' (which i have tried but so far seems a bit problematic, sometimes it does it sometimes it doesn't!!)

cheers
elvis



[ Reply to This | # ]
Edit and sync iCal calendars on multiple machines
Authored by: danielsbrewer on Apr 20, '05 10:03:41AM

Hi,

Yes both icals need to be in publish mode. It is better to run the script than use ical to be honest.



[ Reply to This | # ]
Edit and sync iCal calendars on multiple machines
Authored by: tinker on May 06, '05 04:56:23PM

I've actually done something simpler for years: I just publish one calendar per computer on iCalX.com and then subscribe to all of them on each machine. That way I can add calendar items and view my full calendar wherever I happen to be. The only problem is that I can't alter or delete an entry from machine A if I happen to be on machine B, but in my case anyway I hardly ever find that I need to do so.



[ Reply to This | # ]
Update for Tiger:
Authored by: Wetzel on Aug 04, '05 02:44:58AM

I ran across this hint trying to get something like this working for me . . . unfortunately Tiger has changed where it keeps its calendar files. To get it to work now, you will need to create and set up the calendar beforehand, and then edit the script to point to

~/Library/Application\ Support/iCal/Sources/***SOME LONG UGLY STRING***.calendar/corestorage.ics

you'll need to take a look in your iCal/Sources directory to see what the name of the folder of corestorage.ics is . . . if you have more than one calendar you may need to look at them in a text editor or open them in sunbird to see which is which.



[ Reply to This | # ]
Edit and sync iCal calendars on multiple machines
Authored by: ptone on Oct 24, '05 09:02:00AM
This is a 'first draft' applescript app that lets you do this without having to lookup the corestorage.ics file. -Preston

property icalSupportFolder : (path to home folder as string) & "Library:Application Support:iCal:"
property nodesPlist : icalSupportFolder & "nodes.plist"
property sources : {}
property passwds : {}

on getValue(akey, keys, values)
	if keys does not contain akey then return false
	repeat with i from 1 to count of keys
		if item i of keys = akey then return item i of values
	end repeat
	return false
end getValue

on getPW(source)
	log "PW routine"
	return my getValue(source, sources, passwds)
end getPW

--iCal should be closed to refresh
tell application "Finder"
	if name of every process contains "iCal" then
		tell application "iCal" to quit
	end if
end tell

tell application "System Events"
	--set nodesPlist to POSIX path of nodesPlist
	set calendarList to property list items of property list item "List" of contents of property list file nodesPlist
	set publishedCalendarList to {}
	--set publishedCalendarNames to {}
	repeat with i from 1 to count of calendarList
		set pubData to property list items of property list item "Publishers" of item i of calendarList
		if pubData ≠ {} then
			--set end of publishedCalendarList to i
			set end of publishedCalendarList to ((i as string) & " : " & value of property list item "PublishName" of item 1 of pubData)
		end if
	end repeat
	
	set chosenCalendars to choose from list publishedCalendarList with prompt "Choose calendars to refresh (hold CMD key for multiple)" with title "Published Calendars" with multiple selections allowed
	repeat with aChosenCalendar in chosenCalendars
		set calIndex to characters 1 thru 2 of aChosenCalendar as string as number
		set sourceItem to value of 
			property list item 1 of 
			property list item "Sources" of 
			property list item 1 of 
			property list item "Publishers" of (item calIndex of calendarList)
		set sourceURL to value of 
			property list item "UploadURL" of 
			property list item 1 of 
			property list item "Publishers" of (item calIndex of calendarList)
		
		set sourceFile to icalSupportFolder & "Sources:" & sourceItem & ".calendar:corestorage.ics" as alias
		
		
		(* --- URL Access scripting does not store pw in keychain
		tell application "URL Access Scripting"
			download sourceURL to sourceFile replacing yes with authentication
		end tell
		*)
		
		--using curl for download and storing pw
		if sourceURL contains "@" then --authentication steps
			set username to characters 8 thru ((offset of "@" in sourceURL) - 1) of sourceURL as string
			
			if sources contains sourceItem then
				set passwd to my getPW(sourceItem)
			else
				display dialog "Please enter your password" with title "Web Authentication" default answer "" buttons {"OK, Always", "OK, Once"} default button 1 with hidden answer
				set theResult to result
				set passwd to text returned of theResult
				if button returned of theResult = "OK, Always" then
					set end of sources to sourceItem
					set end of passwds to passwd
					
				end if
			end if
			set sourceFile to POSIX path of sourceFile
			set sourceFile to quoted form of sourceFile
			set userpass to username & ":" & passwd
			set sourceURL to "http://" & characters ((offset of "@" in sourceURL) + 1) thru -1 of sourceURL as string
			set shellcommand to "curl -u " & userpass & " " & sourceURL & " -o " & sourceFile
			do shell script shellcommand
		else
			--no auth needed
		end if
		
		
	end repeat
	tell application "iCal"
		reload calendars
		activate
	end tell
	
end tell


[ Reply to This | # ]
Edit and sync iCal calendars on multiple machines
Authored by: vman on Jan 14, '07 01:58:31PM
thanks, after some hassling setting things up this script works great.

for anyone who might be trying to do the same:
I'm running phpicalendar on my server, and publishing my calendars in iCal.app to the [www.mysite.com]/phpicalendar/calendars/ directory, as described in the publish.ical.php file in that location. (for use with the above applescript be sure to publish to the /calendars/ directory and not /calendars/publish.php , this does not work)
next I've modified the applescript somewhat to bypass the 'choose which calendar'& password dialogs, made it into an application, and put it in the dock instead of iCal.app.
This way when I open iCal now it does a sync/download first from the server.


On this subject,
it would be a better solution if we had something like this that would check the modification dates first before upping/downloading anything.. or come to think of it actually check individual event changes within the .ics files... hmm.
ah well, maybe things get better in osx 10.5.

cheers

[ Reply to This | # ]
Edit and sync iCal calendars on multiple machines
Authored by: luhmann on Aug 11, '06 02:33:58AM

Does this hint still work now that iCal doesn't use .ics files anymore?



[ Reply to This | # ]