OS X 10.9 removed the ability to sync your contacts and calendars between your Mac and iOS device via direct USB connection. (Though it’s rumored to reappear.)
The removal of this feature was sadly unadvertised. I only noticed when I updated my sister’s address on my Mac and it never showed up on my iPhone. I probably would have put off upgrading to 10.9 if I had known about its removal ahead of time.
Apple’s preferred contact and calendar syncing method is now via its iCloud service.
However, I don’t want to use iCloud since Apple has a poor track record with online services (in both longevity and correctness) and I’d prefer not to upload my private information.
Fortunately both OS X and iOS also support CardDAV for contact syncing and CalDAV for calendar syncing. I decided the time had come for me to make the jump and host these services myself, for myself.
OS X Server has built-in support for workgroup contact and calendar sharing, however I’ve learned through extensive painful experience to avoid it.
Apple open-sourced their Calendar and Contacts Server, and I investigated using it as my personal server. Unfortunately the dependencies were steep (PostgreSQL and Memcached required), Linux support nonexistent and basic instructions about how things work were lacking. I have a sad sordid history of dealing with unsupported Apple software, and I decided against adding CalendarServer to the heap.
Fortunately I read about Alex Payne’s Sovereign project when he announced it and I remember it had contacts and calendar support. I looked into it a bit more, and discovered those services were provided via ownCloud.
So I spun up a new Ubuntu Server 12.04.3 LTS VM on VMWare Fusion on my Mac mini sitting at Mac Mini Vault and installed ownCloud 6:
$ sudo apt-get update
$ sudo apt-get upgrade
$ sudo apt-get dist-upgrade
$ sudo reboot
$ sudo su -
$ wget http://download.opensuse.org/repositories/isv:ownCloud:community/xUbuntu_12.04/Release.key
$ apt-key add - < Release.key
$ echo 'deb http://download.opensuse.org/repositories/isv:ownCloud:community/xUbuntu_12.04/ /' >> /etc/apt/sources.list.d/owncloud.list
$ apt-get update
$ apt-get install owncloud
$ sudo a2enmod headers
# s/AllowOverride None/AllowOverride All/:
$ sudo nano /etc/apache2/sites-available/default
$ sudo service apache2 restart
I think that’s enough to get ownCloud 6 running on Ubuntu Server using its SQLite backend. You can add MySQL to the mix if you think you need it (10+ users, speed, scale).
Then I created a self-signed SSL cert:
$ openssl genrsa -des3 -out myssl.key 1024
$ openssl req -new -key myssl.key -out myssl.csr
$ cp myssl.key myssl.key.org
$ openssl rsa -in myssl.key.org -out myssl.key
$ openssl x509 -req -days 365 -in myssl.csr -signkey myssl.key -out myssl.crt
I installed my self-signed cert on my Mac and iPhone (via Dropbox’s Public URL sharing) and rebooted.
I ended up entering the following URL into Contacts.app:
And into Calendar.app:
I was worried what would happen when added these URLs to my iPhone. Would I wind up with a mess of duplicate records? Should I first tediously delete all my existing records, one by one? Fortunately, upon addition of these new data sources, my iPhone offered to delete all existing Calendar and Contact entries. I took the leap of faith and it worked out. Phew.
A final snag is that apparently iOS CardDAV implementation apparently attempts to HTTP GET https://example.com/.well-known/carddav before allowing addition of the CardDAV source to ensure a working service, I guess. ownCloud knows nothing about this, but it’s easy to support what iOS is looking for adding a URL rewrite to your web server config. Here’s my nginx rule:
rewrite ^/.well-known/carddav /owncloud/remote.php/carddav/ redirect;
I’ve been using ownCloud for about four months now and have been happy with it. I’m happy to be able to use cloud syncing without being beholden to a questionable cloud provider.