Attention! This is an old page. Please see the latest information here.

New Web Banner4

iCal Backup Script

Manually backup iCal

iCal allows you to create a backup file by selecting File > Back up iCal. You can later restore iCal by double-clicking the backup file. Restoring iCal from a backup works great as long as you have a recent backup. But that’s rarely the case.

What if you could configure iCal to create backups automatically? You can, with a little help from AppleScript.

Automatically backup iCal

This script will backup iCal when run. You can create alarms in iCal to run scripts. To configure iCal to back itself up every day, create a repeating alarm in iCal that runs this script. Here's how:

  1. Save this iCal Backup script to your Applications folder.
  2. Applescript Icon
  3. Create a new event in iCal that repeats every day (e.g. 11:00 PM).
  4. Backupical
  5. Set the Alarm type to Run Script. Then choose Other... and select the iCal Backup script stored in the Applications folder.
  6. Alarmtype

When finished, the Event Details should look something like this:

Backupical2

Now every night at 11:00 PM, iCal will run the AppleScript and back itself up. And, iCal does not have to be running for the script to run.

By default, the script creates backup files that are date and time stamped (iCal 2008-11-14 23.00.00.icbu) and stores them in ~/Documents/iCal Backups. It archives up to 10 day’s worth of backups and deletes the older backups.

Customize the AppleScript

If you want to alter the location of the backup directory or the number of archives to save, you can open the AppleScript with Script Editor (in /Applications/AppleScript) and change these variables:

Applescript

To change the backup folder, edit this line:

	set destDir to myHome & "Documents/iCal Backups"

To change the number of days to archive, edit this line:

	set deleteAfter to 10