2009-03-16

Backing up Google calendar using wget for Mac OS X

Back when I was on Windows I used wget to download the iCal file of my Google calendar as part of my nightly backup.  I am finally getting around to adding it to my Mac backup script.

First step; Does Mac OS X have wget built in? Doesn't appear to.

I found wget for Mac OS X Leopard on Quentin Stafford-Fraser's blog and followed the installation instructions in the readme file.

The readme file says you will need to add the folder where you put wget to the PATH, so I googled and found these instructions on how to do that:

  • Create the file /etc/paths.d/wget like this: sudo touch /etc/paths.d/wget
  • Edit the file: sudo nano /etc/paths.d/wget
  • Put the path inside the file: /usr/local/bin

Then I looked up the http address of my Google Calendar iCal file by going to Calendar Settings and clicking on the iCal button in the Private Address area near the bottom.

Then I went to Wget manual at gnu.org and figured out the syntax for what I wanted to do:

wget -P /Users/myusername/Documents/Google_Calendar_Backups http://www.google.com/calendar/ical/mygoogleusername@gmail.com/private-randomlettersandnumbers/basic.ics

And then I tested it in a bash script, and when I verified it worked I added it to my regular nightly backup bash script.