Recover iPhone Contacts from iTunes Backup on a Mac
In the event that someone has lost some or all of their contacts from Address Book or Outlook, but had them on their iPhone/iPad, there’s a way to extract the contacts data from the iTunes-hosted backup of their iDevice.
Since the procedure to do it for free can be a little tricky (lots of outfits are willing to sell you a way to do iPhone contact recovery for $24.95 and up), see below the jump for the way I did it.
1. Download iPhone Backup Extractor for Mac.
2. Create a new folder on the user’s desktop. For this example, I’ve named it recover.
3. Double click on the iPhone Backup Extractor application to launch it and click on the Read Backups button to automatically access the stored backups on your hard drive.
4. iPhone Backup Extractor will show you the contents of selected backup. Choose iOS Files and click on the Extract button.
5. iPhone Backup Extractor will prompt you to select the folder where it will extract the backup files. Choose the recover folder you created in step 2.
6. Full backup extraction will take 3 to 15 seconds, depending on the amount of data.
7. Once the extraction is done, navigate to /Users/username/Desktop/recover/iOS Files/Library. Here you will find all important data you need to restore including notes, SMS and the address book files which contain your iPhone contacts.
8. Open Terminal and run the following command:
cd "/Users/username/Desktop/recover/iOS Files/Library/AddressBook"
(Replace username with the user’s login.)
9. Once you’re in the AddressBook directory, you should see two files:
AddressBook.sqlitedb
AddressBookImages.sqlitedb
AddressBook.sqlitedb has the contact data that you’re looking to export out.
10. Next, run the following command:
sqlite3 AddressBook.sqlitedb
11. The prompt should change to sqlite>.
12. Now run the following commands in the order given:
sqlite> .mode csv
sqlite> .output contacts.csv
sqlite> SELECT ROWID, First, Last, ABMultiValue.value, record_id FROM ABPerson, ABMultiValue WHERE ROWID=record_id;
sqlite > .quit
A new file named contacts.csv should appear in the AddressBook directory.
Note: If the user’s backup is encrypted, you’ll get an error when running the following command. The backup will need to be decrypted from iTunes before trying step 12 again.
sqlite> SELECT ROWID, First, Last, ABMultiValue.value, record_id FROM ABPerson, ABMultiValue WHERE ROWID=record_id;
13. If there were no errors, open up the contacts.csv file and check the data inside. If necessary, remove any duplicated items and re-save the document as a .csv file.
14. Import the contacts.csv file into your contacts list.
Thank you so much!
You saved my life!!
that’s a great how-to! would you by any chance know how to restore notes?
Thank You so much. I’ve literally been looking for a week. Worked PERFECTLY!
For recovering iPhones files on Mac OS X, this iTunes data recovery software also works great. See here for more: http://www.squidoo.com/data-recovery-itunes
Merry Christmas!
I would like to see the manual way of doing this, as my company wouldn’t spend the $$$ for the application. Anyone knkow of a site or forum that has it written up?
William,
For recovering your contacts, the free/manual way of doing it is covered in this post. Do you need something else recovered besides contacts?
I see using the Backup Extractor, and the following steps. But I don’t see the manual process for what Backup Extractor does.
Hi after I enter this command :
sqlite> SELECT ROWID, First, Last, ABMultiValue.value, record_id FROM ABPerson, ABMultiValue WHERE ROWID=record_id;
I faced with this error :
Error: near “sqlite”: syntax error
THANK YOU GOT WORK !
Hey after entering,
sqlite> SELECT ROWID, First, Last, ABMultiValue.value, record_id FROM ABPerson, ABMultiValue WHERE ROWID=record_id;
I faced with this error :
SQL error: no such table: abperson
Sam,
The commands are case-sensitive. Are you entering “….record_id FROM ABPerson,” or “….record_id FROM abperson,”?
Hi,
After entering
sqlite> .mode csv
…> .output contacts.csv
…> SELECT ROWID, First, Last, ABMultiValue.value, record_id FROM ABPerson, ABMultiValue WHERE ROWID=record_id;
I got the following
Error: near “.”: syntax error
What did I do wrong?
Thanks
You are an absolute legend. Trying to recover my girlfriends contacts after an update. Now it’s time to setup her google contacts to make sure I don’t need to find this page again. Thanks heaps
Hi,
I extracted the IOS files into a recovery folder – but when I opened the IOS files folder there was nothing in there??
HELP!
Hi there,
I extracted the “AddressBook.sqlitedb” file on my PC.
I do have a mac. So If I just copy the “AddressBook.sqlitedb” to my Mac, how would I do this?
I assume I start at step 9, but I’m confused on how to?
LIFE SAVER!!! Yes…That is what you are sir! Thanks a million!!!
Hey after entering,
sqlite> SELECT ROWID, First, Last, ABMultiValue.value, record_id FROM ABPerson, ABMultiValue WHERE ROWID=record_id;
I faced with this error :
SQL error: no such table: ABPerson
I got the same error because you left out a step which is to change directory to Library of the recovered files:
cd “/Users/username/Desktop/recovery/iOS Files/Library/AddressBook”
I am getting the same error, did you figure it out? I do not understand CK’s reply…I did not forget that step but am still getting the no such table:ABPerson
I get the same error as Leah as well.. 😦
Any way to fix this?
This has been a life-save for me. I recently updated the Office for Mac 2011 and IOS5.1.1 over the air and it all my contacts and calendar disappeared! Now with this tip and utility, I managed to recover my contacts. How do I recover my calendar? Thanks a million!!
Hello. This worked great after hours of research and failed options. However, each contact came through several times – for instance one person has one record for email, one for the work phone, one for the home phone, etc. How do we ask terminal to pull each of those fields as they are labeled in the sqlite file?
Thank you so much for your time on this!
Hi! I get the same error after entering:
…> sqlite> SELECT ROWID, First, Last, ABMultiValue.value, record_id FROM ABPerson, ABMultiValue WHERE ROWID=record_id;
Error: near “sqlite”: syntax error
What’s wrong?
Finally a free and simple way to do this!
Step number 2 is named wrongly..should be “recovery” folder. That’s why directory go hay-wire?
Jieni,
Good catch! I’ve now fixed that, so that the commands and other references now consistently say “recover”.
Hi Everybody,
Does anybody know a simple way to decrypt Itunes BackUp? It seems like my back is encrypted even thought I never ask for it =(
Thanks in advance for your support.
SIncerely,
Astek
Thank you for all of this information — It seems like I have completed all the steps correctly. I see the contacts.csv file in my AddressBook directory. When I imported it into my address book they all came up blank. I clicked the contacts.csv file to see if it had any information in it and it opens in the Numbers program as a spreadsheet where all of the names and contacts I’m trying to recover are displayed. Any advice on how I can get them back on my phone?
contacts.csv appears but it’s empty! What did I do wrong?
i deleted the contacts by mistake from address book on mac and Icloud deleted them from my iphone. Any chance i can retrieve them?
I’m trying to do this and get the same issue as multiple users above… and my back up is NOT encypted, 100% certain, and I didn’t change the case on any of the commands – once I get to this command: “sqlite> SELECT ROWID, First, Last, ABMultiValue.value, record_id FROM ABPerson, ABMultiValue WHERE ROWID=record_id;”
It tells me I have a syntax error… like many others above.
Last login: Sat Jul 28 14:25:26 on ttys000
ic:~ ic$ “/Users/ic/Desktop/recover/iOS Files/Library/AddressBook”
-bash: /Users/ic/Desktop/recover/iOS Files/Library/AddressBook: is a directory
ic:~ ic$ sqlite3 AddressBook.sqlitedb
SQLite version 3.6.12
Enter “.help” for instructions
Enter SQL statements terminated with a “;”
sqlite> sqlite> .mode csv
…> sqlite> .output contacts.csv
…> sqlite> SELECT ROWID, First, Last, ABMultiValue.value, record_id FROM ABPerson, ABMultiValue WHERE ROWID=record_id;
SQL error: near “sqlite”: syntax error
sqlite>
Thoughts on what’s going on?
how to decrypt iTunes
Here is the command i used to navigate through folders:
cd ~/desktop/recover/kos/library/addressbook after logging into my username(which will be default i think)
then i used this command sqlite3 AddressBook.sqlitedb which changed the command line to sqlite>
Next, i ran the following commands one by one in the order given:
sqlite> .mode csv
sqlite> .output contacts.csv
sqlite> SELECT ROWID, First, Last, ABMultiValue.value, record_id FROM ABPerson, ABMultiValue WHERE ROWID=record_id;
sqlite > .quit
This gave me a CSV file which i imported to contacts app. However, i can only see blank names with no contact information in it.
Any solution appreciated. Thanks in advance..!!!
This thing is so complicates. I have given up. I am currently backing up my iPhone contacts via Copy-Trans Contacts.
iTunes has to seriously think of letting people have access to their contact backups!
my phone’s backup is not encrypted but when I followed the instructions, it returns me with the following:
SQL error: file is encrypted or is not a database
Prior to this, this is the whole chain of command that I entered into Terminal:
cd “/Users/zincteo/Desktop/recover/iOS Files/Library/AddressBook”mbp:AddressBook zincteo$ sqlite3 AddressBook.sqlitedb
SQLite version 3.6.12
Enter “.help” for instructions
Enter SQL statements terminated with a “;”
sqlite> .mode csv
sqlite> .output contacts.csv
sqlite> SELECT ROWID, First, Last, ABMultiValue.Value, record_id FROM ABPerson, ABMultiValue WHERE ROWID=record_id;
SQL error: file is encrypted or is not a database
I need my contacts badly cos some idiot stole my iphone 4. So I’m using my iphone 3g currently and apparently I am unable to perform the restoration due to version issues.
Any help is greatly appreciated, and thanks in advance!
The whole thing worked except I don’t see a .csv file… 😦
thanks .. great set of instructions.. worked for me first time although it would be great to add the email addresses etc…
Worked like a charm… Thanks for the this Tut…. Just one ? where do I put the csv? into iPhone(Where)….
Thanks in advance….
I wasn’t aware that deleting contacts from address book on macbook would wipe out all my contacts on my iphone 5…now i have no contacts and have done a factory reset and restore from icloud with no luck. followed your instructions and imported into addressbook but all contacts show up as no name with no data…please tell me how i can fix this.
Thanks for the clear and flawless instruction.
Worked great, but the contacts.csv file is empty. any suggestions?
hello can somebody help me i stood in that part extracting iOS files???
Hi after I enter this command :
sqlite> SELECT ROWID, First, Last, ABMultiValue.value, record_id FROM ABPerson, ABMultiValue WHERE ROWID=record_id;
I faced with this error :
Error: near “sqlite”: syntax error
This mac Tool can recover the deleted fiels in iphone database. I use it.
http://www.datarecoveryforiphone.com/ios-data-recovery.html
Thank you very much.
You help me solve a great problem.
I agree with William, Stellar Phoenix is better among all data recovery tools for Mac. There is no free software for data recovery in Mac. All softwares are free upto some extent, for complete recovery you need to pay. Stellar Phoenix also provide just free scan, recovery is paid.
http://www.ipadconverter-mac.com/iphone-recovery/
For email addresses, physical addresses, etc. I found this SELECT statement to be useful, if a bit verbose:
SELECT ROWID, First, Middle, Last, Organization, Note, Birthday, JobTitle, ABMultiValue.value, UID, ABMultiValueEntry.value FROM ABPerson LEFT OUTER JOIN ABMultiValue on ROWID=record_id LEFT OUTER JOIN ABMultiValueEntry on parent_id=UID ORDER BY rowid, parent_id;
THIS IS THE ONLY THING THAT WORKED TO GET MY CONTACTS BACK!!
A very big thank you to you 🙂
I’ve been searching google all night for a method that would work.
Brilliant
Thank you so, so, so, much!!! Very helpful and detailed. Worked perfectly the first time through. 🙂 Exactly what you need if you’ve lost your iPhone
Have you figured out how to fix this? I cannot seem to find the answer
I am struggling with this because my contacts.csv comes up with an empty Excel file. I see questions here with the same problem…but no answers. Any help to be had?
For those who ask why the file is empty; it’s because there is nothing in your backup. Your contacts were never on the phone to back up. Try this instead: Settings / Mail, Contacts, Calendars / go to each of you accounts and set Contacts to green (on). If your contacts are in ‘the cloud’ they will re-appear once the phone has completed syncing over wifi.