Set up a free CalDAV server

Working Mac

Apple’s Darwin Calendar Server (DCS) is a free, open-source CalDAV server that works with iCal. It’s not the only one, but it’s a good choice—as long as you don’t mind a bit of command-line tinkering. For these instructions, you’ll need a Mac running Leopard that also has Xcode Tools installed (you can find it on your Leopard Install DVD in the Optional Installs folder). On that Mac, open Terminal (Applications/Utilities) and enter this command, followed by Return (note that this should all appear on one line):

svn checkout http://svn.calendarserver.org/repository/calendarserver/CalendarServer/trunk /CalendarServer

This command downloads the DCS source code and puts it in a folder called CalendarServer at the top level of your hard disk. Next, to download additional required libraries and do an initial setup, enter the following two commands, pressing Return after each one:

cd /CalendarServer
./run –s

To set up a preliminary preference file and delete some files that may cause some confusion later on, enter:

cp ./conf/caldavd-test.plist ./conf/caldavd-dev.plist
rm ./conf/caldavd.plist 
rm ./conf/caldavd-test.plist
rm ./conf/accounts.xml

Now you have to set up user account information. DCS can use any of several methods to look up user details, including Open Directory (the method Leopard Server defaults to, and the one that offers the most flexibility). For a small group, however, the easiest setup to get up and running is one that stores all account information in a simple XML text file. That’s the method I describe here. Located in the conf folder, this file is called accounts-test.xml. You can edit it in Terminal (using, say, nano or vi) or open it in Apple’s TextEdit, Bare Bones Software’s $125 BBEdit, or another text editor.

For basic operation, you can leave all the existing text in place, but make sure that somewhere between the opening <accounts realm="Test Realm"> tag (you can change that name to whatever you want, by the way) and the closing </accounts> tag, you include the following information for each user who will access your calendars; substitute the user’s name, e-mail address, and so on:

<user>
    <uid>shortname</uid>
    <guid>shortname</guid>
    <password>password</password>
    <name>Full Name</name>
    <cuaddr>mailto:user@domain.com</cuaddr>
</user>

In addition, because true delegation of one user’s calendar to another is currently impossible without the use of Open Directory, you may choose to include another entry for a basic, low-security shared calendar for the group. Enter a password that all group members will use (note that the e-mail address doesn’t have to be a real one):

<user>
    <uid>shared</uid>
    <guid>shared</guid>
    <password>password</password>
    <name>Shared Calendar</name>
    <cuaddr>mailto:shared@domain.com</cuaddr>
</user>

You must also make a few small edits to the file caldavd-test.plist. First, locate the key ServerHostName. Immediately after that is a line that says <string>localhost</string>. Replace localhost with your computer’s actual IP address (which you can discover in the Network pane of System Preferences). If you have to choose between its public IP address and the private address used on your local network, pick the local address. Next, decide whether you want to have normal, unencrypted access to your calendars or use SSL to encrypt calendar traffic. (Either way amounts to about the same effort; SSL gives you more security but may be unnecessary on a local network.) Depending on your decision, you’ll make one of two changes. Look for this portion of the file:

<!-- HTTP port [0 = disable HTTP] -->
<key>HTTPPort</key>
<integer>8008</integer>

<!-- SSL port [0 = disable HTTPS] -->
<key>SSLPort</key>
<integer>8443</integer>

For an unencrypted connection, replace the 8443 in the second section with a 0. For an encrypted connection, replace the 8008 in the first section with a 0. (In some network configurations, leaving both options enabled at the same time produces unpredictable results, so you’ll achieve the best results if you choose one or the other.)

Finally, locate the key BindAddresses. Below that is a line that says <string>127.0.0.1</string>. Leave that in place, but immediately beneath it, add a second line that’s identical except that it contains your computer’s real IP address—again, use its private address if you have a choice. Save the caldavd-test.plist file.

Now, to run the server, enter the following in Terminal: ./run -d

You should now be able to connect to it following the instructions in “Corral Your Calendars”. When adding any user’s account in iCal, after entering the Description, Username, and Password, click on the triangle next to Server Options and enter the server’s IP address and port into the Server URL field, in the following format: http://192.168.0.10:8008 (substituting the server’s actual IP address); use https and 8443 instead of http and 8008 if you’ve set up DCS to use SSL.

To make the server run automatically every time you restart your computer, you must follow several additional steps:

1. Open the file run (in the top level of the CalendarServer folder) in a text editor. You must make changes to this file in two places to enable it to run automatically at startup (thanks to Toby Rush for discovering this issue and describing the fix on his blog). First, find these lines:

case "${USER}" in
  wsanchez)
    proto="svn+ssh";
    ;;
  )
    proto="svn";
    ;;
esac;>

and replace them with just this one:

proto="svn";

Then, find these lines:

case "${USER}" in
  cyrusdaboo)
    base="svn+ssh://cdaboo@svn.osafoundation.org/svn";
    ;;
  )
    base="http://svn.osafoundation.org";
    ;;
esac;>

and replace them with this one:

base="http://svn.osafoundation.org";

2. Launch Peter Borg’s free Lingon utility. Click on New, select Users Daemons, and click on Create. Then enter com.apple.calendarserver into the Name field; enter /CalendarServer/run -d into the What field; select Run It When It Is Loaded By the System (at Startup or Login); and click on Save.

3. Log out and log back in. The Calendar Server process should run automatically in the background. These steps provide only a very basic CalDAV setup. To add locations or resources (both of which do support delegation, even without Open Directory), or to further customize your setup, you’ll need more information than we can supply here. A good place to start is the calendarserver-users mailing list, or the searchable list archive.

"Set up a free CalDAV server" Comments

By tjunker Tue Apr 01 12:13:02 PDT 2008

What about those of us that still use Tiger? How would the instructions change. Surely it must be possible in Tiger as well. I don't plan to upgrade until Leoprad reaches a 10.5.5 release.

By cphoffman42 Tue Apr 01 12:58:59 PDT 2008

tjunker - iCal did not use the CalDAV standard in Tiger, so we're out of luck (I'm also still using Tiger, though this and the fixed Time Machine/AEBS may finally be enough to get me to upgrade).


That said, this looks crazy complicated. Any hope that Macworld will be covering other calendar servers in the near future?

By Peter Cohen Tue Apr 01 13:10:20 PDT 2008

Here's another solution:


[url="http://www.communigate.com/community/"]Install Communigate Pro Community Edition[/url]. It also sports CalDAV support, and is free for five users or fewer.

By cweber Tue Apr 01 13:57:18 PDT 2008

@tjunker: Tiger's iCal does not have CalDAV support, if I recall correctly, so you're out of luck.

By tjunker Tue Apr 01 14:12:09 PDT 2008

Yeah, I guess that's correct. I was confusing that with Address Book's LDAP preference setting. That would be something else nice to set up. My parents share a MacBook, and they each have ti use their own Address Book which is quite annoying. I tried to share one address book database much the same way as I am sharing iTunes and iPhoto between two users, but while that works well for iTunes/iPhoto, with address book it does not.

By bkemper Tue Apr 01 20:11:01 PDT 2008

Is there anything yet that will act as a bridge between an Outlook server and CalDAV support in iCal?

By andypullen62 Tue Apr 01 20:13:12 PDT 2008

I'm getting an error when I enter the Terminal command "./run -p". Additionally, I think that Apple (or somebody) updated this DCS, because the file directory listed in this tutorial is different than the actual one. Also, it says that it was last uploaded 7 hours ago (8pm pacific). Could this be the cause of the error?

By pln Tue Apr 01 21:13:08 PDT 2008

andypullen62:

I've just set this up and it worked fine. Did you really type "./run -p"? This article doesn't mention using "./run -p" - just "./run -s" and "./run -d"

"./run -p" (according to the command line info) means "Print PYTHONPATH value for server and exit".

At what point is it failing for you?

By pln Tue Apr 01 21:16:02 PDT 2008

cphoffman42:

This is about as simple a command line setup I've come across in my life. About three minutes from grabbing the code to adding an account on my iCal. I just wish every server application was as easy.

At work, we usually set aside a couple of hours for server setups, assuming we've done it before and don't expect any problems.

By bretbenz Sat Apr 05 14:53:02 PDT 2008

There is a major error in this:

"To set up a preliminary preference file and delete some files that may cause some confusion later on, enter:

cp ./conf/caldavd-test.plist ./conf/caldavd-dev.plist

rm ./conf/caldavd.plist

rm ./conf/caldavd-test.plist

rm ./conf/accounts.xml"

This essentially copies caldavd-test.plist into the caldavd-dev.plist. Then the rm command removes the caldavd-test.plist.

However a bit down the article it says to edit the caldavd-test.plist file.

"You must also make a few small edits to the file caldavd-test.plist."

So how can one edit the file that was just deleted?

If you try to edit the caldavd-dev.plist file which was created, it is also missing the tags described here:

"Finally, locate the key BindAddresses. Below that is a line that says 127.0.0.1"

Right below the BindAddresses I only get "

and there is no string with those IP numbers.

But putting 111.111.111.111 in the middle works. It still works with this file but its written wrong in the guide.

By andypullen62 Sat Apr 05 15:33:19 PDT 2008

I got it to work, and it works really good. However, I wanted it to sync a calendar between my wife and I, and that part works, but I can't figure out how to get my iPod touch to add to that calendar (it syncs to the iPod, but the iPod doesn't add to it). So I ended up spending 40 bucks on BusySync, which works fine (but isn't free).

By netnik Sun Apr 13 10:43:31 PDT 2008

I feel like I am probably asking a very naive question, but entering the first line of this article into the terminal produces the result that the svn: URL doesn't exist.

Do I need to have subversion enabled on my webserver? Something beyond what is installed with Leopard?

By pln Sun Apr 13 18:54:58 PDT 2008

If you have the developer tools installed you'll have subversion, and you'll need the dev tools to build the CalDAV server.


The URL is valid (I just tried it). What exactly do you see (copy and paste from your Terminal)?

By netnik Sun Apr 13 22:52:08 PDT 2008

Ahh, I see that the initial path contains a space between "trunk" and "/CalendarServer".

I was working on a remote server and I typed in the path description, rather than copy and pasted it. With the break on the page as viewed above, I just never picked up on the space.

pln,.. thanks for spotting me.

Sign in to post a comment. New to Macworld Comments? Register here.

Make Your Dreams Come True!

Enter the Dream Come True Sweepstakes Enter for a chance to win $25,000 or your choice of other great prizes in the Dream Come True Sweepstakes brought to you by Macworld.

Enter now »