Mac OS X Server

Nuke+Pave iCal Server in Lion Server

It is possible to remove all of the content from a Lion Calendar server using Postgres. To aid you in doing so, Apple has built out a couple of commands to make the process easier. This will nuke everything from the server and so is not something that should be lightly done. To do so, first stop the Calendar service in the Server application. Then let’s back up the database:

pg_dump -U _postgres caldav -c -f /db_backups/caldav.sql

Then run dropdb to remove the database itself:

dropdb -U _postgres caldav

Once the database is gone, run the calendar_bootstrap_database script (I prefer doing so verbosely):

calendarserver_bootstrap_database -v

Now you should be able to start a fresh, clean calendar database by starting up the Calendar service in the Server application again. Note, this is dangerous if you have production data. Also note that you cannot run the bootstrap until you delete the database.