Dealing with a weird problem with Mail.app and Contacts.app using different AddressBook files on OSX Mountain Lion

Recently I had to switch my Apple MacBook. I used the Apple Migration Utility to transfer my profile from one machine to another. This worked fine and everything seemed to be okay. However After a week or so of using the new machine there was one strange problem: Mail.app would only find email addresses from the recent list. I found that I couldn’t lookup email addresses from my AddressBook in the Contacts app. So how to fix this? This is the story. It was quite a challenge.

Whenever I get a problem like this I resort to “The Google” and see if others have had a similar problem. There were plenty of reports of problems with syncing AddressBook with iCloud, However, my iCloud syncing and Facebook integration was all working fine. Just to be certain I first did a backup of my AddressBook from the Contacts app. I recommend doing this before any major changes to your Contacts App since your contact database is often one of your most valuable resources.

To do the backup I went to Contacts and did File…Export…Contacts Archive to create the backup.

I followed some of the advice online and tried to reset my Contacts database. I quit the Contacts.app and Mail.app. I then went to System Preferences…iCloud and switched off iCloud Contacts syncing.  

I opened Contacts.app and checked my contacts were still there. All good so far. But opening Mail.App there was no change. I still couldn’t get mail to lookup email addresses for any of my contacts.

I closed both Contacts and Mail.app and went back to System Preferences…iCloud and switched contact syncing back on. After waiting for iCloud to re-sync with Contacts I opened Mail.app and Contacts. No change. Mail.app would still not find any of my contacts email addresses.

I then went to Mail.app and checked out the Address Panel. There were only two AddressBook entries. The first was for Apple and the second was My AddressBook card. 

I tried adding an email address from Mail.app in to the AddressBook. This allowed the email address to found in Mail.app but the entry did not show up in the Contacts.app. At this point it was obvious that the two applications were not talking to each other. They were working off different copies of the AddressBook database.

At this point it was time to take a look under the covers. Time to  open up Finder and take a look through my user profile Library folder (~/Library).

My first visit was to ~/Library/Application Support/AddressBook. 

The AddressBook-v22.abcddb file was large and looked to be too big to have just 2 records in it.

I went back to Google to search for some more ideas.  One article mentioned the Containers folder in ~/Library. This is apparently part of the sandboxing that has been implemented in OS X Mountain Lion.

I took a look in ~/Library/Containers and found a com.apple.mail folder. 

This folder had a Container.plist file and a Data folder.

The Data Folder held two Folders:

– Documents
– Library

The Library folder was really interesting it had a number of folders that mimicked the folders in the ~/Library folder:

Application Scripts
Application Support
Caches
Cookies
Images
LaunchAgents
Logs
Mail
Mail Downloads
Notes
Preferences
Saved Application State
SyncedPreferences

I looked in the Application Support folder and found:

AddressBook
CrashReporter
Mail
SyncServices 

I looked in the AddressBook folder and found the following files and folders:

AddressBook-v22.abcddb
Configuration.plist
Images
MailRecents-v4.abcdmr
Metadata

The contents of the Images and Metadata folders matched the AddressBook entries that were being used by Mail.app.

Finally I had conclusive proof that Mail.app was using a different AddressBook file and I had found the database it was using. The next step was to figure out a way to fix it. The challenge is that there is nothing in Mail.app’s preferences to force it to use a different contacts database and the only way to re-install Mail.app is to re-install OS X. I wasn’t ready to do that. So there must be another way.

After taking copies of both AddressBook folders I moved the AddressBook folder in ~/Library/Containers/com.apple.mail/Data/Library/Application Support/
to AddressBook_broken inside the Application Support folder.

I then went to ~/Library/Application Support in Finder and created an Alias of the AddressBook Folder. I then moved it to the ~/Library/Containers/com.apple.mail/Data/Library/Application Support/ folder and renamed it to remove the ” alias” in the folder name.

I then tried Mail.app but no luck. As I suspected Aliases don’t work very well. It was time to resort to Terminal. First I deleted the Alias that wasn’t working

I decided to try a symbolic link. A quick Google to get the syntax right and the following steps worked:

cd ~/Library/Containers/com.apple.mail/Data/Library/Application Support/

ln ln -s ~/Library/Application Support/AddressBook AddressBook

I then fired up Contacts.app and Mail.app. It worked! Contacts was using the AddressBook database and Mail.app was too.  To make sure everything was okay I added an email address using mail.app. I switched to Contacts.app and the entry appeared there too.  I then edited the entry in Contacts.app and added a picture to the entry.

While I am at this point I have to point out the retarded change in Contacts.app in the handling of pictures. in the Lion version of AddressBook you could simply drop a picture on to the Picture Frame in an AddressBook Contact Card and the card would be updated. In Mountain Lion it is a major step backward in usability. You now have to switch in to edit mode for the contact record. Then you have to go and edit the picture. Then you have to select the “Recents” tab. Finally you can drag and drop a picture in to the edit window and select Done. 

After doing this and saving the Contact Card I went back to Mail.app and made sure the preference…Viewing tab had the option set to “show contact photos in the message list.”

Now the updated photo displayed in Mail.app against an email from the addressee. This is a really useful feature because when you are scanning through a list of emails it is easy to spot the emails from people you are interested if you have added a picture to their contact card because you will see that picture next to the email message instead of the grey head and shoulders profile.

While I was troubleshooting this problem I did call Apple. They were incredibly efficient. They called back exactly when I scheduled them to. Within minutes after discussing the issue with the Support Rep (I had solved the problem at this point – but I was concerned that an update to OS X might break it)  I was connected within two minutes to the next level expert. It seemed I had solved the problem. However, there seems to be a problem lurking here. It shouldn’t be this hard. The fix is definitely beyond the scope of many users. 

The support rep gave me their contact details and when I got home I found an email address asking if I could document the steps I went through. So Glen, this is for you…. Rather than keep the solution to myself I have written this up and posted the information to my blog where  others may find it and hopefully give a clue to solve the problem if others experience this.

Pre-#SXSW13 HealthCampAustin planning for Thursday March 7th, 2013 – Are you in?

I need to see if HealthCampers are interested in taking part in a HealthCamp in Austin on Thursday March 7th, 2013. 

We still have a lot of details to pull together but I am pretty sure I have a location lined up on River Place Boulevard in Austin. What I need to do is to see who is interested in arriving in Austin before SXSW to take part in HealthCamp.  
I would like to make the theme for the day “Big Data delivering insights for personal health”
So the big question is who is in?

Let’s kick SXSW off in a big way with an exciting HealthCamp event!

#PIPHCA – Reg4All Registries for all diseases @sharonfterry

Registries for all presented by @sharonfterry

Industry sponsored registries exist. Time consuming and costly to build.

We need people and their data.

Biomedical research and healthcare are laggin in entering the INFORMATION age.

Individuals are collecting information in a fragmented fashion.

Reg4All merges:

– Disease InfoSearch
– Trials Finder

Trials Finder enables patient registration. 
Enables self-reported medical information

A gamified survey 
– Common Data Elements – Measure in a consistent way across diseases.
– Add Disease Specific information.

Engagement is critical – but why will people engage?

Data Today for Solutions Tomorrow.

The question comes down to why will people engage and how will they trust this group?
Drive this from the disease advocacy organizations.

The unique element is to to add privacy controls via Private Access. https://www.privateaccess.info

“We try to do too many things with blanket access – We have to be granular and let people give permission” 

“People need to reclaim their health”

Go for all 13,000 diseases – the co-morbidity info will be astounding

The winners for this challenge will be announced on December 12th. – Watch out for it on: www.collaborateactivate.com or www.partnersinpatienthealth.com

#pphca – Partners in Patient Health – Flu Near You

Flu Near You – Vaccine Preventable Diseases remain an issue.

People distrust vaccines but because of their success people underestimate the impact of the diseases they prevent.

The CDC estimates that the Flu costs $10.4B each year in medical costs.

Participatory Health needs to engage the public in Public Health.

Participatory surveillance engages the public in monitoring activities.

Register by phone or web.Surveys received via email and take less than 10 seconds to complete.

Flu Near You helps you find sources for vaccine.

Flu Near You reports back on your local community. People like this local knowledge.

People like the mobile app. They like to be able to change location.

http://flunearyou.org

Already 9,000 users. Piloted in San Francisco. 80,000 surveys completed.

Partnering with LabCorp to enable local testing.

This app is designed to scale globally and to expand to other diseases beyond flu.

People find the map is invaluable. They like to interact with the map.

Initial engagement will be the challenge. One suggestion was to use the Boy and Girl scout organizations to drive family engagement. eg. a public health awareness badge.

Can people identify if they are in a high risk group? This done via Vaccine Finder where high risk groups are identified so that the right vaccine can be identified.

FluNearYou is different from traditional reporting methods. Traditional methods use reporting from HealthCare professionals. FlueNearYou offers earlier detection opportunities.

Puerto Rico is funding development for other diseases.

The real time aspect of this app really helps detection and treatment.