Other Entries

Log

Synch iCal without .Mac

The main thing preventing me from using iCal is the requirement to purchase a .Mac account to synch between two computers. Since iCals .ics files are just text files, I’ve thought about using CVS or rsynch to do it. I finally got it together and wrote a little applescript using CVS. It requires that you have cvs installed on each machine you want to synch. It’s included in Developers Tools. If you don’t know how to set it up, the Apple Developer Connection article Version Control with CVS on Mac OS X is a great place to start.

Here’s the applescript:

tell application "Finder"
	set wasRunning to (0 < (count ¬
	(application processes whose name is "iCal")))
end tell
if wasRunning then
	tell application "iCal"
		quit
	end tell
	do shell script "export CVS_RSH=\"ssh\"; ¬
	export CVSROOT=\"--YOUR CVS ROOT PATH--\"; ¬
	cd /Users/--YOUR SHORT USERNAME--/Library/Calendars/; ¬
	/usr/bin/cvs commit -m \"--YOUR COMMIT MESSAGE--\" *.ics >> ¬
	/Users/--YOUR SHORT USERNAME--/Library/Logs/iCal-cvs.log"
else
	do shell script "export CVS_RSH=\"ssh\";¬
	export CVSROOT=\"--YOUR CVS ROOT PATH--\"; ¬
	cd /Users/--YOUR SHORT USERNAME--/Library/Calendars/; ¬
	/usr/bin/cvs update *.ics >> ¬
	/Users/--YOUR SHORT USERNAME--/Library/Logs/iCal-cvs.log"
	tell application "iCal"
		activate
	end tell
end if

Substitute paths and save as an application without a startup screen. You’ll need to make a version for every machine you want to synch. For easy access, I gave my apps a custom icon and stuck them in the Dock.

To set it up, import your Calendars directory into CVS and do the following on each machine:

  1. Delete ~/Library/Calendars (or rename)
  2. In the terminal, set your environment variables, CVSROOT and CVS_RSH, if they’re not set in your .profile file
  3. cd to ~/Library and CVS checkout Calendars

The application is designed to detect whether iCal is running or not. If it is running, it quits iCal and then does a cvs commit on your calendar files; if iCal’s not running, it does a cvs update and starts iCal with the updated files. The important thing is that you use the new application to start and quit iCal. Otherwise, you won’t update your data.

All messages from CVS are stored in the iCal-cvs.log file located in ~/Library/Logs/. CVS can be relatively verbose, so you may want to set a cron job to delete the file every so often.

The only drawback to this method is that there are a lot of changes being committed, so your cvs repository will probably get pretty big over time. I think that rsynch may be a better way to go, but I’ll have to figure that one out.

Besides, when it’s 2008, you can always rollback your schedule to those uncomplicated days in 2004…

05/06/04 01:20PM Geekiness Macintosh

Recently Played on iTunes

  1. “Heroin”
    The Velvet Underground & Nico
    The Velvet Underground
    11/17/08 16:26
  2. “All Tomorrow's Parties”
    The Velvet Underground & Nico
    The Velvet Underground
    11/17/08 16:20
  3. “Run Run Run”
    The Velvet Underground & Nico
    The Velvet Underground
    11/17/08 16:16

Last 100 Songs >