How to Restore Lost Contacts to Your iPhone

This article will tell you how to restore contacts which were lost/erased from iPhone, due to iTunes trashing them during a sync, especially after a firmware upgrade.  Restoration of your contacts is possible only if you either have an iTunes backup, or a copy of your AddressBook.sqlitedb.  It is particularly useful for people who lost their contacts after an upgrade to iOS 4.3.2, because iTunes refuses/fails to restore the contacts from a backup.  If you want to skip my rambling discourse, you can cut to the chase, and skip directly to the step-by-step instructions.

I’m always wary of updating my iPhone, because I’ve had many many problems with that over the years. But when the untethered jailbreak for iOS 4.3.2 came out this week, I felt it was time to finally upgrade from iOS 4.0.2. While the iPhone Dev Team has released redsn0w 0.9.6 rc 14, for this purpose, this tool isn’t appropriate for iPhone users who want to retain carrier unlocks, because it allows 4.3.2’s new baseband to be installed, for which there currently is no unlock.  In order to keep your phone unlocked, you need to use a tool which prevents your baseband from getting updated.  Luckily, iH8Sn0w has released Sn0wbreeze 2.6, which preserves your old baseband, thus allowing you to keep your unlock.

It’s important to make a backup of your iPhone via iTunes before doing any firmware updates.  Also, it’s a good idea to use iTunes to Transfer Purchases from your iPhone back to your computer.  For once, update went smoothly, and I thought I got off easy this time, because the phone booted right up after the Sn0wBreeze was done.  Little did I know that things are not always as they first appear.

The next step was to restore the phone from a backup that I’d made just prior to doing the firmware upgrade.  iTunes finished the restore without any complaints, but  when my phone rebooted, the first thing I noticed was that most of my apps were missing.  That was OK, I was able reinstall the apps via iTunes (and then had waste 1 hour rearranging my 200 apps back into folders).  When I went to use the phone, however, I discovered that all of my contacts were gone! Remember, I backed up my iPhone before doing the upgrade, so why didn’t %#$  iTunes restore my backed up contacts??? Ack! At this point, I knew that there was a high probability that I would be wasting a good part of my day getting my contacts back into the iPhone.

The contacts in iOS are stored in a file on the iPhone at /var/mobile/Library/AddressBook/AddressBook.sqlitedb.  The first step was to find where this file was backed up on my PC, and to see if it had my lost contacts in it.  I started searching my computer for the iTunes backup, and found a bunch of subfolders in C:\Users\<MyUserName>\AppData\Roaming\Apple Computer\MobileSync\Backup (Note: I’m using Windows 7).  Sure enough, there was a folder named 905279ef2efbc76bc402c0e411fc356d75ed95b0 with a timestamp around the time that I made the last backup.  Inside the folder are multitudes of files with hexadecimal filenames, as well as some .plist and .mdbx files.  Manifest.mbdb appears to be a a cross reference of the filenames to their path on the iPhone, but I didn’t want to waste time trying to find a program to decode it, so I simply opened up a Command Prompt, and grepped for a string that is unique to AddressBook.sqlitedb:

grep UpdatePersonLinkUponPersonUnlink *
Binary file 31bb7ba8914766d4ba40d6dfb6113c8b614be442 matches

Bingo!  I opened up 31bb7ba8914766d4ba40d6dfb6113c8b614be442 in GnuEmacs, and sure enough, it was an sqlite database, contained my the lost contacts from address book!  I’m curious to know if the same filename always maps to AddressBook.sqlitedb, or if the filename is random, so if any readers can verify this, please leave a comment below.  OK, it should be a piece of cake to restore the file, right?  First, I tried to fool iTunes into restoring the file for me.  I created a new backup via iTunes, and copied the old 31bb7ba8914766d4ba40d6dfb6113c8b614be442 into it and then tried to restore this hacked backup.  No dice.  iTunes noticed something was different, and complained that it couldn’t restore some of the files.

OK, how about renaming 31bb7ba8914766d4ba40d6dfb6113c8b614be442 to AddressBook.sqlitedb and then copying it to the proper location on the iPhone? Should be easy, right?  I downloaded the latest version of iFunBox, a great free utility that, among its many talents, allows you to drag and drop files in and out of any directory of a jailbroken iPhone.  Using iFunBox, I navigated to /var/mobile/Library/AddressBook, copied the AddressBook.sqlitedb from my PC over the file that was already in my iPhone.  Then, I rebooted the iPhone…. Still no contacts!  When I examined the contents of the iPhone again with iFunBox, I found that my new file had been overwritten.  The problem is that when you shut down the iPhone, it writes out the contacts from RAM, overwriting your substitute AddressBook.sqlitedb before it has a chance to read it!  How annoying!

I spent the next few hours trying various methods to get around the problem.   The most straightforward way would be to get the iPhone to crash, so that it wouldn’t have the chance to overwrite my AddressBook.sqlitedb, but I couldn’t figure out how to do that.  I tried using ssh to log into the iPhone and kill -9 random processes.  That didn’t work, but in the process, I found that a program that refreshes the AddressBook.sqlitedb:  /System/Library/PrivateFrameworks/DataAccess.framework.  The problem is, if you kill it, it immediately restarts before you have a chance to sneak your new file in. So how can one prevent that damn program from overwriting the new address book??  I tried changing the file access to readonly … it changes it back to read/write.  The process runs as a user named mobile, so I tried changing the file owner from mobile to root to prevent it from overwriting the file.  It just changes the owner back to mobile!  How frustrating!  Finally, I happened on the combination that works:  change the file owner to root, and disallow all access to the file! Eureka contacts restored!

Step by Step Procedure

Note:  This procedure requires a jailbroken iPhone.  This topic is too complicated to discuss here, and there are many tools available, but Sn0wbreeze is what I used time time round.

1. Extract AddressBook.sqlitedb from your iTunes backup

New Method:

A user has brought to my attention a cross platform program (Windows/OSX/Linux) which simplifies the extraction of AddressBook.sqlitedb from your iTunes backup. Download and launch iTunes Backup Extractor on your PC.  Click the Expert Mode button, and Navigate to and click the checkbox next to Library->AddressBook->AddressBook.sqlitedb, and click the Extract Selected button to copy the file to your PC.

Old Method:

If you already have a backup copy of AddressBook.sqlitedb from another source, skip this step. grep is a Unix command which doesn’t come with Windows.  If you don’t have a copy of it, you can download and install Gnu grep.  Find the directory containing the latest backup of your iPhone using the Windows Explorer:

Windows 7/Vista: c:\Users\USERNAME\AppData\Roaming\Apple Computer\MobileSync\Backup
Other versions of Windows: C:\Documents and Settings\USERNAME\Application Data\Apple Computer\MobileSync\Backup

Substitute your user name for USERNAME.  Find the newest subdirectory.  This is your latest backup.  Open up a Command (DOS) Prompt, and cd to the latest backup directory.  Find the file containing the backup of AddressBook.sqlitedb:

grep UpdatePersonLinkUponPersonUnlink *
Binary file 31bb7ba8914766d4ba40d6dfb6113c8b614be442 matches

Using Windows Explorer, copy the found file (in my case, it was named 31bb7ba8914766d4ba40d6dfb6113c8b614be442) and rename it to AddressBook.sqlitedb.

 

(Optional) If you want to verify the contacts before proceeding, you can view the contents of AddressBook.sqlitedb by using SQLite Database Browser.  Load AddressBook.sqlitedb into SQLite Database Browser, and select the table ABPerson from the Browse Data tab to see what names are contained in it.

Update 2011/05/19:  I have devised a simplified procedure which supercedes the remaining steps below: Restoring AddressBook.sqlitedb to iPhone – A Simplified Procedure

2. Install OpenSSH

Use Cydia to install OpenSSH on your iPhone.  You can find it by using Cydia’s search function.

3. ssh into your iPhone

Using an appropriate ssh client on your PC (I used PuTTY), ssh into your iPhone.  Your iPhone must be connected to the same WiFi network as your PC to do this.  To find your iPhone’s IP number,  go to Settings->Wi-Fi on the iPhone, and tap on the blue circled arrow next to the network you’re connected to.  Log in to your iPhone as user root, password alpine.

4. Copy your replacement AddressBook.sqlitedb to the iPhone

Download iFunBox and launch it.  Navigate to Raw File System->var->mobile->Library->AddressBook.  Drag and drop your replacement AddressBook.sqlitedb onto iFunBox to copy it to the iPhone.

5.  Change file owner and access of AddressBook.sqlitedb on the iPhone

Via ssh, type the following into the iPhone:

cd /var/mobile/Library/AddressBook
chown root AddressBook.sqlitedb
chmod 0 AddressBook.sqlitedb

Note:  the ‘o’ in “chmod o …” above is the number zero.

6. Reboot the iPhone and restore AddressBook.sqlitedb’s file attributes

Restart your iPhone.  It will act strangely because it can’t access your AddressBook.sqlitedb.  Mine was kept cycling from the boot up screen to the lock screen over and over again, and it was impossible to operate it.  Don’t worry, you can still ssh into it.  From your PC, ssh back into the iPhone and type the following commands:

cd /var/mobile/Library/AddressBook
chown mobile AddressBook.sqlitedb
chmod 644 AddressBook.sqlitedb
reboot

Your iPhone will reboot, and your contacts will be restored!  It’s a good idea to disable ssh when you’re done, or change the root password to prevent random hackers from hacking into your phone.

 

Related Articles:

Restoring AddressBook.sqlitedb to iPhone – A Simplified Procedure

 

There are 97 Comments to "How to Restore Lost Contacts to Your iPhone"

  • Ryan says:

    Hey, so I don’t understand the grep command. I’ve installed both Gnu Grep and also tried installing Windows Grep but I still get the ” ‘grep’ is not a recognized command” or whatever message. Is there any way you can dumb this down further? How do I get the AddressBook.sqlitedb file from my old contacts? I have the 31bb7ba8914766d4ba40d6dfb6113c8b614be442 file from my old contacts, but what do I do with this? I also can ssh into my iPhone and can see the new (blank, contact-less) AddressBook.sqlitedb file, but how do I get my contacts from the 31bb7ba… file into that Address Book file?

    • lincomatic says:

      OK, great, I wasn’t sure if it’s always saved with the same name. On my Mac, it had a different name. First, you should check to see 1) is it really your AddressBook.sqlitedb and 2)does it have the contacts you need in it. First, use Windows Explorer to copy the file, and rename the file to AddressBook.sqlitedb. Download and install SQLite Database Browser as I instructed in the article, load AddressBook.sqlitedb into it, and check the ABPerson table for your contacts. If it looks like the right file, then use iFunBox to drop it on top of the blank file that’s currently in your iPhone, and follow the rest of the instructions.

  • Ryan says:

    OHHHH! So I just take the “31bb7ba…” file and RENAME that file “AddressBook.sqlitedb”?

    Gotcha now! I was wondering where you got that file from. Alright, let’s see if this works now!

  • Kevin says:

    I can’t get this to work. I’m on a mac, and I have an addressbook.sqlitedb file that i extracted from an old backup. I’m using cyberduck to ssh in, and replacing the file usig the GUI on cyber duck. Once the file is replaced, I followed all the command steps. My iphone acted just as yours did, but after the final reboot it had reverted to the blank addressbook file. please help!

    • lincomatic says:

      Try rebooting it twice before doing Step 6. And before the final chown/chmod, check to make sure the file that’s there is still the version that you dropped in. Let me know what happens.

  • Ben says:

    Thank you so much! I had been trying to fix this all day after a messy update/jb for 4.3.3, and this was what finally fixed it. I couldn’t get grep to work, so I just used iPhone backup extractor to grab the file, but everything else worked perfect. I had tried a similar method, but it didn’t work like this did. You probably saved me quite a few hours working on this. Thanks again!

    • lincomatic says:

      Glad it worked for you. Thanks for the feedback. And thanks for mentiong iPhone Backup Extractor. I think I’ll update the article to use that instead.

  • Lucas says:

    Thanks Lincomatic, this worked for me!

    I’m using Windows 7 and just upgraded to 4.3.3.

    Just to note, the first time I tried this, it failed for me. I just came back to this 2 hours later and now it’s work again, THANK YOU SO MUCH!

  • Michael says:

    I cannot get it to work. It serms to me that my iphone is immediately doing something to deny this from working after I execute the “chown”. The apply symbol and a progress bar come up. I do not get my phone having problems after step 5 and after step 6 I have a phone with no contacts in it. Please help!

  • Michael says:

    correction; the apple symbol

  • Michael says:

    PS> I can only type one command line in at a time on my SSH client, does this eff me up?

    • lincomatic says:

      It’s OK that you can only type 1 command at a time. That’s the way I do it. Try reversing the order of chown/chmod. If that doesn’t work you can stack the commands in one command line with ; between them. Please report back what happens. Also, is it iOS 4.3.2?

      • Michael says:

        No it’s 4.1 – is that why it won’t work? I’m trying your suggestions right now, will report back.

  • Michael says:

    Alright, so I tried grouping the commands together. The problem I am experiencing is that effing Apple (how we all love them so much) is still overwriting my hardwork after I execute the second group of commands. Instead of overwriting when I execute the second chown is now its overwriting upon reboot. I get the Apple symbol and then the status bar filling up and then it always deletes all my contacts. Any guesses? I’m running firmware 06.15 and iOS 4.1 – and I really hate Apple.

  • Michael says:

    I get the first step perfectly, my phone reboots but kicks me out of “contacts” because the permission is changed to “0”. But the overwriting begins when you try to change back using the second group of commands.

  • Michael says:

    Ok, I’ll wait for your post back. I tried changing permissions to 400 – t didn’t work. I also read that group and owner need to be the same for your camera, contacts, etc in the iPhone ut don’t know how to do that. Any additional feedback you could provide would be great. I have my contacts, just can’t load them into the iphone and this is the closest I’ve got to success.

    • lincomatic says:

      Let’s try to dissect this in more detail. You drop your AddressBook.sqlitedb into the phone. Then when you ssh and do
      chmod 0 AddressBook.sqlitedb;chown root AddressBook.sqlitedb
      then if you follow that with
      ls -l
      Is the file still the replacement one you dropped in? After you reboot the phone, and you say it’s “kicking you out of contacts” if you do “ls -l” again, is your replacement contacts file still there, or did it get overwritten?

  • Michael says:

    Okay if I follow the first couple commands with

    Is -I then restart my phone, the replacement file in the var/mobile/library/addressbook folder gets copied over. The iPhone still boots me out of contacts because I think permissions = 0.

    When I redo the Is -I it still will not allow me access to the folder and my addressbook file is overwritten.

    What’s next?

    • lincomatic says:

      Are you typing the right thing? “ls -l” .. that’s lower case l lower case s, space, lower case l. The command is to show the file attributes and size.. is it showing the file you copied in, or the smaller empty one? What do you mean you can’t access the folder. You should *always* be able to see the folder if you ssh in and
      cd /var/mobile/Library/AddressBook

  • Michael says:

    I copied and pasted the command from your instructions. I mean that when I executed the first group of commands and then the ls -l command and restart and then try to access my contacts, it hangs for a moment and then boots me out. I checked to see if the addressbook file was the same or overwritten after I did that and it was overwritten. My phone will also then crash into safemode at this stage and then restart.

    so. . . what do you think?

    • lincomatic says:

      You shoud *not* try to access your contacts after the chmod 0/chown root. Just reboot it. After the reboot, is the file still there, or is it overwritten? Again, DO NOT run any programs, especially contacts. If it’s not overwritten, try rebooting it again (you can type “reboot” at the ssh prompt). Then check again.. if it’s not overwritten, then do the chmod 644/chown mobile. And reboot AGAIN BEFORE trying to access contacts.

  • Michael says:

    Okay followed your instructions exactly –

    chown 0/chmod root; reboot result= not overwritten
    reboot result= not overwritten
    chown 644/chmod mobile; reboot result= overwritten

  • Michael says:

    Any suggestions?

    • lincomatic says:

      I’m assuming that was a typo above, and that you reversed the words chown & chmod. OK, definitely something different going on w/ the version of iOS you’re using. How about try the same thing, but use chmod 444 instead of chmod 0.

  • Michael says:

    Yes it was a typo, but that’s because you made the same mistake in your post above that one and I didn’t really want to get off track, I just want to get this solved.

    The overwriting doesn’t occur when I use chmod 0, it’s when I come back with chmod 644 and change the chown back to mobile. Then the iPhone writes over it. I will try your suggestion.

  • Michael says:

    Update:

    chown mobile/ chmod 444/ reboot result= overwritten

  • Michael says:

    SOrry, I am actually dislexic, you didn’t make a mistake.

    • lincomatic says:

      No, you’re not dyslexic.. I changed it after you pointed out my error. OK sorry, but I really don’t have any more ideas, except to upgrade to 4.3.2 or 4.3.3, the two versions which have been tested as working with my hack. Isn’t Apple infuriating? I wish I knew enough about iOS to figure out what mechanism automatically restarts the contacts process when you kill it.

      • lincomatic says:

        OK, this is a willd stab in the dark, and I can’t guarantee that it won’t mess up your iPhone so badly that you need to restore it, but if you’re game… In my discussion above, I thought I figured out which program keeps overwriting the AddressBook.sqlitedb. I found the mechanism whereby that program is restarted. What you can try is to boot the phone w/o that program getting loaded, drop in the file, and then restart it. So this is what you would do:
        1) copy /System/Library/LaunchDaemons/com.apple.dataaccess.dataaccessd.plist to your computer
        2) delete the file from the iphone
        3) reboot
        4) drop in your new AddressBook.sqlitedb
        5) drop the /System/Library/LaunchDaemons/com.apple.dataaccess.dataaccessd.plist back into the iphone
        6) reboot

        • lincomatic says:

          OK I just found a reference that says it’s safe to disable dataaccessd. While you’re at it, also do the same thing with com.apple.AddressBook.plist.

  • Michael says:

    Followed those instructions per the letter. result= overwrites upon last reboot

  • Michael says:

    Deleted those TWO files. Rebooted. Replaced AddressBook.sqlitedb. Rebooted

    Then the iPhone overwrote STILL and those two files were deleted.

  • Michael says:

    I don’t think those files are the ones overwriting the addressbook.sqlitedb

    • lincomatic says:

      Tenacious little bastard. I’m out of ideas. I’ll let you know if I think of something else.

      • lincomatic says:

        OK, I just tried it on 4.3.2, and the procedure works for me, so I guess there’s something different about 4.1. Here’s exacty what I did
        1) copy /System/Library/LaunchDaemons/com.apple.dataaccess.dataaccessd.plist and com.apple.AddressBook.plist to computer
        2) delete them from iPhone
        3) reboot
        4) drop in new AddressBook.sqlitedb
        5) reboot. Verfied new AddressBook.sqlitedb not overwritten, launched Contacts … restored addressbook works
        6) copy the 2 plist files back to iphone
        7) reboot. iPhone works normally with restored contacts.

        What I like about this new procedure is that it doesn’t require ssh.

  • Michael says:

    Well at least we’re learning how to eff with Apple more and more. I think it’s just a file in 4.1 – soooo close, yet so far away.

  • Michael says:

    so – followed those instructions. Deleted two files. Copied the addressbook.sqlitedb into the iPhone. Rebooted. Went to contacts to check if restored. Nothing! Overwritten. Bastards!

    It’s weird how the 4.1 is more advanced in overwriting than 4.3, could it be the firmware overwriting, I had to install 06.15 onto my phone.

    • lincomatic says:

      I’m starting to wonder if maybe your AddressBook.sqlitedb is corrupted. Have you tried loading it into a browser? If you want, you can send it to me and I’ll see if it works OK on my 4.3.

      Another approach … do the laborious procedure that I used to isolate the process which overwrites the file.. After dropping in the new file, I used “ps ax” to list all the running processes, a then did “kill -9” on them one by one until I found the one which overwrote the file. Once we know which process is the culprit, it will be a snap to turn it off via LaunchDaemons.

      But I think it’s more likely that your file is corrupted or incompatible w/ 4.1. Where did you get it? Was it from a 3.x backup?

  • Michael says:

    Yes, it was from a 3.X backup. What does this mean? Do you recommend any programs that I can just open my contacts up and enter them manually into my phone?

    • lincomatic says:

      Is the file readable in SQLite Database Browser? I think the ABPerson table has the info you need.

  • Michael says:

    It has the names, but not the phone numbers.

  • Michael says:

    Found the phone numbers, I’m flying to Amsterdam tomorrow, so guess what I’ll be doing all flight! Thanks for your help.

  • Carlos says:

    Thankss, saved my life,

    For those tha do not use win or mac, I did all the steps on ubuntu linux, using ssh and filezilla instead of IfunBox, but i had my addressbook.sqlitedb backup, thanks again, gresat help

  • Ian Molyneux says:

    Thank you very much. been trying to sort this all day and came across this and you have sorted me out.
    Thank You.

  • Brad says:

    FINALLY GOT THIS TO WORK — HERE’S HOW

    I was updating from IOS 4.0.1 to 4.3.3 — backed up, updated the formware — no contacts. Did a restore — no contacts. Used iphone-extractor to get my sqllitedb files (include AddressBookImages.sqlitedb) — followed the above steps — nothing worked. However, I noticed that my sqllitedb files weren’t being overwritten — they just weren’t having an effect. Finally I decided to search the file system for an files with the same name — and it turns out that AddressBook.sqllitedb ALSO resides in /private/var/mobile/Library/AddressBook/ — I followed the above instructions using that file location (as opposed to /var/root) and everything worked. FINALLY!

  • Minh ing says:

    yeah, it works. Thank you.

  • Roman says:

    I think I am trapped in the same manner as Michael was – i got this bloody 4.1 which constantly overrides my contact file…None of the solutions help here. Just wanted to check if any solution has been found since Michael frustration?

    Thank you

  • tomtonajeron says:

    I have a 4.1 addressbook backup too, and yet, I still have a problem with my contacts too. any solution??

  • yoan06 says:

    Hello
    I lost all my personnal contacts after an update on Cydia ( AndroidLockXT + Libs )
    My contact synched with my Exchange accound was still here but all other ( my Iphone contacts ) lost.
    Apple only way to get it back is to restore 30gigs of data with Itune
    reset all password and copy again all music just to have the contacts back ….
    It’s bad situation
    I tried to do with your solution but after extracted AddressBook.sqlitedb from the last itune backup
    I saw with SQL lite all contacts inside where only the one liked to the exchange account and not the one linked with “My Iphone ” group

    So there is another file somewhere in the Itune backup with my contact inside ….
    but where ……..
    if someone knows, feel free to say ! ;~))

  • chez says:

    How about if my iphone backup is missing info.plist, status.plist, manifest.plist, manifest.mbdb, and manifest.mbdx, so all I have are the files with hexadecimal filenames and there are about 300. iTunes doesn’t recognize the backup, so i can’t restore the backup to my phone using iTunes. Is there still a way to recover data using what I have?

  • Jimmy says:

    Hey,

    thx for this excellent guide!
    but nevertheless it didn’t work for me
    I guess I need to copy the data AddressBookImages.sqlitedb as well in the directory
    so, do you know by chance in which data this one might be in my backup folder?

    as the file AddressBook.sqlitedb in 31bb7ba8914766d4ba40d6dfb6113c8b614be442!

    I would be very happy if you can give me a hint 😉

  • Jimmy says:

    yes, I did! but it does give me an error for that backup!

  • lincomatic says:

    Just use grep in a terminal on the backup files and search for the name of the file you want. i can’t remember the exact procedure now, but I think there was a plist file that was a master key to the filenames. If you’re doing it on a PC instead of a Mac, you can just use Window’s search function

  • Jimmy says:

    how I use this grep?
    I downloaded it, but it just a pack of pdf files :/

  • Jimmy says:

    YAY!!!!!!!
    finally I got it in the end after hours work,…yeah

  • jason says:

    hi their,
    i dont have a clue about all the things mentioned above lol , not very good when it comes to these things, long story short, ive never been able to update my ihone 3g as it keeps going for hours and still nothing so yesterday after it playing up i tried restoring phone but must have missed the backup prompt first and now my phone is updated but is as a new phone ,all contacts/apps/everything lost , ive tried EDIT/PREFERENCES/DEVICES to see if any older syncs their ,but only 3 from yesterday so have i lost everything or is it hiding somewere ? any help would be great and thanks in advance

  • Liquidmod says:

    No words to THANK YOU.

    Really Thank you… 🙂

  • Josh says:

    Umm can u help me with a problem. What if ur iPhones in factory setting after your iTunes crashing urging the IOS 5.1 update? Nd u don’t hav a back up file? Plz help ASAP thanks

  • Sohail Rahim says:

    Hi,

    Any idea where the address book file sits (or what it’s called) in an iOS 5 backup?
    i’ve got a whole load of files (including the manifest files), but none of them want to open in the sqlite db viewer…)

    i’m not that worried about restoring the numbers directly to the phone.. i’d be happy enough just getting a list of the numbers and can put them in manually.

    Here’s the list of files I see in my backup folder:-

    [ huge file list deleted by moderator ]

  • jaydot says:

    Thank you!!!

  • sharon says:

    hi, um.. really i can’t understand what im supposed to do right now, i get really confused to follow the instruction..
    i hope you dont mind to help me with this one,
    im using email exchange on my iphone and this morning i got a pop up message asking for change my pasword (it always happen once a month). After i input the right pasword, my friend calling and it got crashed (turn into a safe mode) and i just restart my iphone. after that .. my contacts is turn to 0 name, but in the recent calls and favorite the numbers is still there.. please help me..

  • Jeremy says:

    OMG! I tried everything on the internet to get my contacts back after upgrading to ios 5.0.1 and it worked perfectly, you saved my life, really!! Thank you sooooo much!

    (Do you have any hint to restore sms, call history and other stuff??)

    😀 thanks again!!!

  • Enrique says:

    Hi Lincomatic,
    I BELIEVE I FIGURED IT OUT!

    [long story, fast forward below for the quick solution 😛 ]

    I stumbled upon your blog looking how to restore my backed up contacts.
    I follow your 2 methods and neither of them worked for me. I basically suffered same issue as Michael (the guy posting earlier above)… every time I was copying over the Addressbook.sqlitedb over I could see the contacts in both Phone App & Contacts App but as soon as I press Home button, the Apple logo showed up with a progress bar and after that the contacts were empty again.

    I tried MANY things. None seemed to work. It was frustrating since I thought I was so close on every attempt until you find it does not work. Your 2nd method did not work so I went and read carefully the 1st -long- one trying to figure out. I even tried my own tricks, like firing iTunes and running a Backup straight away just after copying over the file. It actually backed up the contacts as I could see the same file length for the 31bb7ba8914766d4ba40d6dfb6113c8b614be442 file inside the iTunes backup folder. Then I would try to restore the backup and it would fail complaining there was one file it could not restore. Then I read about the permissions thing. That was the only thing I did not try, but Michael did not seem successful at it. Then I opened the files with SQLite Database Browser. Went on ‘Browse Data’ tab and I compared the field named ‘_ClientVersion’ under ‘_SqliteDatabaseProperties’. I read on another website somebody was telling to edit that field and put 12 on value. That did not make any sense since my backup from 4.2.1 had 33 in there and I noticed that the empty AddressBook from 4.1 had 32. Probably that people was talking about that when FW 3.2.1 or whatever older one was current. I gave it a chance and changed my backup from 33 to 32, saved it and copied the updated AddressBook.sqlitedb over to /var/mobile/Library. Guess what, IT WORKS STRAIGHT AWAY! WITHOUT RESPRING OR REBOOT NEEDED. That is all what it was required.. no need to kill any process nor delete any plist nor change any permissions. So if we extrapolate it to any other iOS version, like 4.3.3 or 5.0.1 I guess it should work.

    So below is a summary of the steps required, which should work for any iOS version:

    [S O L U T I O N]

    (1) FIRST GET A COPY OF YOUR CONTACTS from either an old backup (read posts above to find out where in iTunes backup are the contacts stored and how to retrieve them. Long story short, your best bet is to locate the following filename inside iTunes backup folder: 31bb7ba8914766d4ba40d6dfb6113c8b614be442, copy it somewhere else and rename it to AddressBook.sqlitedb. That will do. Alternatively you could have a copy of the contacts file that you got from accessing your iPhone’s file system by using some file browser like iPhonebrowser or i-FunBox. The contacts file is stored in /var/mobile/Library/AddressBook/ and the file name is AddressBook.sqlitedb. There is also another copy in /var/root/Library/AddressBook/ but I’m not too sure what that one is being used for. Initially I thought one was used by the Phone App and the other by the Contacts App but that is not the case. Also note that many people incorrectly talks about a different path being /private/var/… It is actually the same file accessed (mounted) through a different route. This is a Unix thing if you are not familiar with Unix filesystem…

    (2) Then get a copy of the empty contacts from your current filesystem. WHY WE NEED THAT? Well, as I explained earlier, we would need to match the version (_ClientVersion) under ‘_SqliteDatabaseProperties’ in the old backup of AddressBook.sqlitedb to match the current versdion in your iOS. YOU CAN SKIP THIS STEP IF YOUR ARE RESTORING CONTACTS FROM SAME FIRMWARE/iOS VERSIONS. Otherwise, open SQLite Database Browser (Freeware app, Google it…) and go on ‘Browse Data’ tab and write down the numeric value of the field named ‘_ClientVersion’ under ‘_SqliteDatabaseProperties’.

    (3) now open the backup copy of your AddressBook.sqlitedb with your contacts and edit that field to match the same version number in the current iOS. Save the file! (update it).

    (4) FINALLY copy over the updated copy of your AddressBook.sqlitedb to both /var/mobile/Library/AddressBook/ and /var/root/Library/AddressBook/ and you should see the contacts in your Phone App and Contacts App right away, no need to reboot or anything!

    I spent a few days until I got this right. I honestly don’t know much about the iPhone but I have become an ‘expert’ by just browsing the net and figuring out things by myself. So I encourage people to do so and learn. There is a bunch of crap out there… and it is up to us to filter it and seize the good stuff. Good luck!

    All the Best,
    Enrique,
    a Spaniard from Valencia in SPAIN working in Silicon Valley, California

    • lincomatic says:

      Wow! Great detective work! It’s certainly a lot easier than my method.
      Thanks! I’ll update my article when I find the time.

  • rosi says:

    i tried your new method. but it stated i have to register. i have to pay to use it? when i tried extracting using the expert mode, it prompted that since im not registered, they will only restore 2 at a time with extra short delay. well, i didnt mind extracting 2 at a time but after i tried a few times, i didnt have more contacts extracted although i got the prompt 1 of 1 file restored from backup successfully. help pls! i need my contacts back! n i dont understand the old method at all! help!

  • jmend says:

    Hey – thanks for an awesome user guide on this tricky issue. I wonder why apple doesn’t address this issue…

    I wonder whether you could answer a question though.
    I have followed the steps in enrique’s comment (copied old contacts sqlitedb, opened the new sqlite file and copied the client version number into the old sqlite file, copied the amended old sqlite file via ifunbox into my iphone 3g into the folders specified). But the contacts do not appear at all.
    I”m wondering maybe it’s because the old contacts file was backed up from a iphone 2g and that maybe the database structure has changed? I also copied the amended sqlite file into more locations (wherever I could find the /Library/AddressBook folders) but still nothing.

    Can you point me to what I’m doing wrong?
    Thanks in advance and once again appreciate your efforts.

    • lincomatic says:

      Yes, it’s a great question why Apple ignores this issue. I’m shocked about how many people have been having the problem. I thought I was just an oddball. I don’t think it matters which phone your file was backed up from.. more the version number. You might try comparing the sqlite structures between your old backup and the new version you’re installing. Also if enrique’s way didn’t work, try my Simplfied Method. Good luck.

  • jmend says:

    Super cool! it worked! Have been battling for these contacts for so long….. Following your Simplified Method it worked. Thanks a million!
    http://blog.lincomatic.com/?p=384 – link to Simplified version

  • Ragnhild says:

    Hi, hope you can help me.. Ive been googleing my ass off, but cant seem to find out whats wrong. Ive located the backup file with all my contacts (i can see some of the contact names in between all the codes), and ive uploaded it to SQLite database browser, but i cant seem to find the contacts on there. i can see the number of contacts, but it doesnt show under “browse data”. am i doing something wrong, or is there just no way for me to extract my contacts from that file? Hopefully someone knows what i can do! A million thanks in advance!!

  • Ryan says:

    My mother just upgraded her iPhone and whatdjya know, all of her contacts be gone. After reading this article I realized there is a limit to my love for my mother and that limit is right about where you mentioned setting up an ssh server on the iPhone. Sorry mom, time to call mac support 🙂

  • Ali says:

    Awesome. Worked Like Magic, You saved my ass. Great work

  • orb says:

    Hi there!
    i rename the 311bb…442 file to AdressBook.sqllitedb, but in SQL lite Manager or Browser, if I select the AB person table, there are no rows , no contacts.

    This file is 476kb big and in simple texteditor there are contacts and numbers but in not readable format (mish mash). What I am doing wrong ? Thanks in advance.

  • orb says:

    I think this file is encrypted. So I am not able to extract data from adressbook.

  • Mihir says:

    Hi, i used iFunbox but under raw file system, i dont hae library, i did get AddressBook.sqlitedb thorugh the iphone back up extractor thing. Since i cant get the library folder in ifunbox how else do i replace my addressbook.sqlitedb file? PLEASE HEELP. APPRCIAT IT

  • moo says:

    I have a question, I am a 3GS new bootrom, I was 5.0.1 with baseband 5.16, i needed to unlock, so I downgraded to 4.1 with baseband 6.15 now and it works, but everything is deleted. is there anyway I can somehow restore the data I have (on itunes) on my iphone after the downgrading (mainly I need the contacts and msgs)
    Thanks

  • blaqsc0rp says:

    great! finally a guide that is easy and working, could restore my contacts with pictures – THANK YOU

  • tim smith says:

    I tried to put some of my music on to my friends phone. I plugged his phone in to my mac and APPLE ERASED ALL HIS CONTACTS ! ! ! DO NOT PLUG A FRIENDS PHONE INTO YOUR MAC YOU WILL LOSE ALL YOUR CONTACTS ! ALL CONTACTS LOST. This is a disaster created by APPLE. Even after spending 8 hours learning how to use terminal and restoring from Back up ALL CONTACTS WERE PERMANENTLY LOST. NEVER USE iTUNES !

  • Alexis says:

    I love you Dude, saved my life

  • Sam says:

    Thank you very much , followed the steps and got all my contacts back, Thanks again.

  • roomtivek says:

    Greetings! Very useful advice within this article! It is the little changes that will make the
    greatest changes. Thanks for sharing!

    • Doon Ladi says:

      I want to recover my contacts of my iPhone 6, the contacts file is lost due to update to iOS 8.2, what can I do?
      My friend recommends me to use FonePaw iPhone Data Recovery, she said that it works for her to recover photos from iPhone, but I do not know whether it works for me to recover contacts.
      Can you give me some suggestions?

  • Zeof says:

    OH! I understand it. find the file name “31bb7ba8914766d4ba40d6dfb6113c8b614be442 “…. I found it but it’s my recent new contact and no old contact. How could I get my contact from 4 days ago back (i have sync contact to my pc but when it was transfering, my friend called to me and i picked the phone, after that… my contact lost all)

  • Tony says:

    I backed up my iphone 4s copying the entire var directory, it consumed 160gigs for a 32g device. I found the gist of it in a keychain.plist file. What I am needing is to be able to get my old contacts before I made the mass backup and the upgraded from 4.x to 5.1.1. Unfortunately I was recieving the error “Itunes cannot save the backup on this computer” message so I have no other sources other than hoping I have a copy which I can transfer back. I have copied and moved the “Address” files back to the device but my contacts do not seem to be replaced nor changed in any way, I did have prior backup from a year ago but as part of the troubleshooting steps I deleted the old backups, so I am screwed if I don’t figure out how to restore via iFunbox.

    • lincomatic says:

      Use iPhone Backup Extractor to extract AddressBook.sqlitedb from every backup that it finds, and check the contents of each of them using sqlite viewer. If none of them contain the contacts you’re looking for, then you’re out of luck.

  • carol says:

    I am over 50- so technologicaly challenged somewhat ! 🙂 My husband got an Iphone 4s as I have an macbook air he decided to use my iTunes. Somehow he got all my contacts. Then he deleted from 550 to 212 ..he deleted all off my phone too…but I still have the numbers just no names. I have just got a new 1phone 4s only 16 Gig … how can I find my contacts ? can anyone help me?
    Many thanks for reading this
    x Carol

    • lincomatic says:

      If he he didn’t sync his phone after deleting your contacts, then your new iphone should be able to get all of them back.
      Otherwise, you need to restore your new phone from a backup … did you back your old phone up? Use iTunes to restore it from a backup of your old phone. You can also try Iphone Backup Extractor to browse your old backups, and then follow my instructions for restoring the contacts if they are intact in a backup.

  • Dima says:

    Ios 4 to Ios 5
    copy tables from ios4 file
    1.ABperson
    2.AbMultivalue
    to Ios5 addressbook empty file
    through any SQLite editor

Write a Comment

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>