An upgrade of my Synology NAS from a wheezy, underpowered (for any more than file sharing) DS215j to a shiny new DS923+ means I can start to use a lot more of the Synology apps rather than relying on docker images on raspberry pis etc, and all the hassle that brings with backing up and restoring docker containers.
Synology offer nice, fully featured calendar and contacts apps so I dived in. The calendar app was a breeze and synced with MacOS no problem at all (and android via Davx5). Job jobbed, all data on MY NAS, under my control and nicely backed up within the synology backup tools.
Then we come to the Synology Contacts app. Works great with Davx5, seamless. Awesome. However, could I get the damn thing to sync with Apple’s contacts app within MacOS. Browsing the various forums it seems it’s a well known issue and is down to Apple’s implementation of carddav in a slightly non-standard way. I have found a solution.
It appears that Synology creates several address books per user (private, team etc) and yet Apple’s implementation is expecting only one addressbook, hence it gets its knickers in a twist when it tries to sync. I found a post on the synology forum which seems to have done the trick. In a nutshell it involves manipulating the postgres database on the Synology to rename the addressbook for each user to ensure the addressbook starts with a ‘1’. This is then the first addressbook Apple’s app looks for and so should sync.
The steps are:
- In the web interface for synology contacts untick all address books for each account except ‘the main addressbook’
- Enable ssh access to the nas
- login in to the nas via ssh
sudo psql -u postgresto access the databases
\lto list the databases, you should see synocontacts
\c synocontactsto connect to the contacts database
\dto list the tables
select * from addressbook;(the semi colon is important!) to show the contacts. Find the ID of the user that matches the carddav link in the web interface of synology contacts
update addressbook set uri='carddav link' where id ='id of user';and change the first digit of the carddav link to a 1
On your mac, fire up the contacts app and add an account –
- Contacts/Add Account
- ‘Other contacts account’ and continue
- Type is Carddav
- Account type is Manual
- Username is the Synology NAS username
- Password is obvious
- Server link is <name or IP of synology NAS>/carddav/Username
- Click sign-in
Give it a few seconds and you should see your contacts piling in.