Access iPhone Backup, recover files from iPhone backup

output from python fileIt was bound to happen sooner or later. I took a photo with my phone and used the image as the wallpaper for when the phone is locked. However, I completely overlooked this when I deleted the original image from the camera roll. This meant I had an image in place but no way of accessing it, and I quite liked the image!

It turns out that when you connect your iPhone to your Mac and iTunes starts, it runs a backup and places some files in your ‘~Library/Applications Support/MobileSync/Backup folder. The problem is that they are SQLLite files and not easily readable in any simple way. This is where I turn to the Apple community, particularly the discussions, and ask for help. Here is the post I made.

I was so pleased with the response – almost immediate and ultimately one of the most helpful. It appears there is a Python script able to open those files and restore the folder structure from the innards of your phone. The thread answers the questions most folk will have, but I thought I’d post here too.

What you need to do is copy the backup folder and all it’s contents to an easily accessible place – I chose a new folder on my desktop. Copy the Python script into the same folder. You then need to change the permissions on that script to ensure that it is executable. You should do this through the terminal, which means you’ll probably need to use ‘sudo’ and ‘chown’ to set the values correctly. Once you have done this you can run the script. You do this by typing ‘sudo’, then the complete path to the script, a forward slash, then the complete path to the folder (you can simply drag the items into the terminal window to do this and the paths will be filled in automatically for you). Finish with a forward slash and then ‘*.mdbackup’.

What this will do is reconstruct the entire iPhone folder structure inside the place you have got the python script and backup folder. Once done you can then set the permissions for the resulting foder and copy to all items inside… you can then access and manipulate the files.

This was, in fact, ludicrously easy – I had help from a former colleague who is something of a star with this stuff, but if you know a few basic commands in the terminal you should be OK.

I’ve also uploaded the Python script for you all to download from here in case it goes offline elsewhere. The original is HERE. The one I used (and changed ownership on) is HERE.

This entry was posted in Computer Tips, General Comments, Mobile Phones, Photography, scripting general. Bookmark the permalink.

62 Responses to Access iPhone Backup, recover files from iPhone backup

  1. james says:

    Hi there are you able to help me restore some of my notes from the backup file.
    I lost it during last restore :( , it has all my notes about my baby.

    pls help.

  2. Hal says:

    Hi James – yes, the process I describe above does give you access to the ‘Library/Notes’ folder, but in it will be a ‘.db’ file. You can open these with ‘BBEdit’ on a Mac easily enough, and you’ll be able to get to the text for the notes, if not the notes themselves. You should at least be able to find what you wrote.

  3. aido says:

    all I’m getting is ‘no such file or directory’
    am I missing something?

  4. Hal says:

    Thanks Aido – your message doesn’t say what you have done, so I can’t be sure if you are missing anything.

    Go to the user library/application support/mobile sync/backup folder and copy that (or move it) to your desktop. You can put it in a folder there if you wish, to keep things neat. Put the python script in the same location as the backup folder, which will have a string of numbers and letters as a name.

    Start the terminal, and type the following, changing the path to be relevant to you:

    sudo /Users/account name/Desktop/foldername/decode_iphone_backup_v2.1.py /Users/account name/Desktop/foldername/Backup/backupfoldername*.mdbackup

    Obviously you put your own account name in the string, your folder name if you are putting the backup into a folder on your desktop, and the actual string of numbers/letters of your backup folder from the library. You can do this most easily by first of all typing sudo, leaving a space then dragging the python script to the terminal window… the path will get filled for you. Leave a space, then drag the backup folder to the terminal window, then add a forward slash, a star a dot and the word mdbackup. Like this /*.mdbackup

    Press return and the script should run. If it doesn’t. I suggest that you go back to the thread on Apple discussions and chat to the people there who will be able to give you far more help than I can!

    You may need to change permissions on the python script to allow it to run (chmod) and you should be good to go. When done you should then change the ownership on the output folder (chown) so that you can access it.

  5. blacksocks says:

    Check out the nice tutorial at menoob.com.

    Never been so easy!

  6. kirsty says:

    i’ve had a iphone since december, and when i brought it i synced it to my home pc which runs on windows xp, so 700 of my precious photos were copied to my iphone which was great, then last week i brought a new laptop that runs on vista(as we have had problems with our home pc, so it has had to be reformatted so all my pics and music were lost) an when i plugged my iphone into the laptop itunes automatically opened and it said ‘backing up iphone’ i then synced my iphone to the laptop which then deleted all of my photos, but how do i access the backup file? and where does it actually save to? someone please help i desperately want to retrieve my photos

  7. Hal says:

    Kirsty – I believe the backup is stored in Vista here:

    C:\Users\USERNAME\Application Data\Apple Computer\MobileSync\Backup

    or here:

    C:\Users\YOURUSERNAME\AppData\Roaming\MobileSync\Backup

    This will need to be opened using the same sort of process I’ve described above, but I am not in any way able to advise about PCs I’m afraid. What I would do if I were you is go and copy that backup folder before any further backups are made – take it and put it in a place where you won’t delete it… burn it to CD if you have to, so you make sure you’ve got those photos.

    The Python script above should work on a PC based backup too, but I have no idea where or how to run it on a PC. Do you know anyone with a Mac who can run the scripts described above? Or anyone who knows both systems well enough to translate the process from Mac to PC?

  8. kirsty says:

    thanks for the advice but i cant access the things you’ve shown above, and now when im on itunes and im trying to create a ringtone it wont allow me too, and just keeps saying error 11556! its too frustrating, i’ve never had a problem with itunes or any ipod and now ive got the iphone i cant do anything i used to

  9. Hal says:

    It may well be time for a trip to the Apple store and a visit to the Genius bar then… :-(

    Why can’t you access the files?

  10. Ritika says:

    Hi, I lost my iphone and want to recover my contacts and notes… is there any way of doing so?? please let me know…

    thanks.

  11. Ritika says:

    Hi, I lost my iphone and want to recover my contacts and notes… is there any way of doing so?? Also, i own a Dell inspiron 1525 and not a Mac…please let me know…

    thanks.

  12. Hal says:

    I’d say there’s a very good chance if you open the backup file as described above, all of the data is in there, and if you use the Python scripts you’ll get it back as text and not as a database file.

  13. Emily says:

    I don’t have a folder called library :S

    What should i do to restore an image?

  14. VaughnSC says:

    Just search on MobileSyncBrowser (Win/Mac) and give it a try

    Vaughn (Author)

    http://homepage.mac.com/vaughn/msync

  15. mickeyb says:

    wot’s the point of having a “back-up” if you can’t get it onto your phone without all this hassle. Steve Job should be renamed Steve Jobbie

  16. Hal says:

    I think you miss the point, Mickeyb… the backups can go onto the phone just fine, but occasionally you might need direct access to the files in the backup to use elsewhere. This was certainly the case for me when I lost a precious photo which I only had as a screen saver image. I didn’t want it only on the phone, so had to go and get it out of the backup archive. This is why I started finding out about how it works and where it’s stored.

  17. MrGreenFingas says:

    Dear All,

    I am having a simliar problem.

    My story: Mt IT guy at worked configured my iPhone to work with IMAP so i could get e-mail on the move. In doing this it syncronised with my outlook (full of out of date contacts) and overwrite all my current contacts on my phone with a jumbled mess of old contacts.

    Where i am upto: After hours of scoureing the net i found a program i though could do the job, it’s called abc amber iPhone convertor. I tried the demo and it looked to good to be true so i paid for the full version, it’s pretty much useless to be honest. The reason being it only retrieves name, email, company and job title. WHERE IS THE PHONE NUMBER :-( works great if your trying to get your texts back though.

    If anyone has any further information i’d be glad of the help.

  18. kwekuananse says:

    I synced my 1st gen iphone with my new mac air and lost all my 3,500 contacts on my iphone except about 30 or so recent ones. I desperately need them back! HELP PLEASE!!!

  19. david levita says:

    hey there hal im trying to recover my iphone data from mac which runs on 10.4.11
    it wont open your extractor program is there something that will work on my slightly older mac? thanks very much…david

  20. Hal says:

    Mr GreenFingas – if you have every made a backup of your iPhone using iTunes then the method detailed in the post will work for you, but if you have changed to IMAP and then created a new backup, overwriting the old one, or have deleted the old one from before IMAP then you’re out of luck, I think.

    kwekuananse – Did you have an older mac then? Do you still have it… can you get to run the Python script described in the blog post? If so, all is not lost. Did your iPhone get backed up before you synced (it should do automatically)? If so, this could still get back your data. Have you tried the method here?

    Hi David – I could have sworn this works on 10.4.x as well as 10.5.x, since it is only a Python script and should run on both OS. You need to run it using the Terminal – you can’t double click on it – and it should work just fine… what did you do to try to get the script to run?

  21. shaun says:

    how do i do this on a xp platform

  22. Hal says:

    Shaun – try the instructions for Vista above… the backup should be there.

  23. shalomii says:

    Hi Hal,
    I was just wondering if this works with encrypted backups as well?

    Thanks

  24. Pingback: Recover iPhone Data from Time Machine - MacNN Forums

  25. Hal says:

    That’s a really good question – I’m afraid I don’t know… I guess it depends on how the encryption was done, but I really couldn’t tell you for sure. If you try it and find any answers please do let me know.

  26. michelle says:

    hi i am trying to get a ringtone on my iphone but it keeps saying error 11556 what can i do

  27. Sunny says:

    Hi, I connected my iphone to back up data to my new computer(the old one’s gone). I guess I didn’t do it right so I have no contacts, calendar data or notes now. I did choose to merge data so all my datas were in my iphone but when I connected my iphone again to my computer, it synced again and then all my datas were gone! Most importantly, I have no contact data anywhere else. Of course, it’s nice to have my ical data back too. I found an address book folder in back up like you said but the file names are AddressBook.sqlitedb & AddressBookImages.sqlitedb which is not readable. How can I access these folders? Do you think I can find my datas?
    Please help! Thanks a lot!!

  28. Sunny says:

    BTW, I downloaded decode iphone back up v2.1py but I don’t know how to use it. sorry… I don’t know much about computer…

  29. Yann says:

    I had to restore my Iphone because it was corrupted and wasn’t able to receive any calls (call emission was OK). I solved the issue by restoring the iphone. The problem here is that all my photo, sms,… are in the corrupted backup. I’m able to read the files from this backup but is there a way to write those files in the new backup ?

  30. Vista and XP users might want to try the iPhone Backup Extractor at http://www.reincubate.com/labs/iphonebe. There’s a free version.

  31. suebdoo93 says:

    I tried this method because I lost my notes when I upgraded to iPhone OS 3.0. I don’t really know any commands.. I copied the text from your script, copied to TextEdit, saved it in the same folder as a copy of my backup, and changed the extension to .py. I opened Terminal, typed sudo followed by a space then I dragged the script, put a space, dragged the backup folder and put /*.mdbackup

    This is what I got. Your help is appreciated! Thank you!

    susan-wileys-macbook:~ suew$ sudo /Users/suew/Desktop/iphone\ backup\ copy/decodeiphone.py /Users/suew/Desktop/iphone\ backup\ copy/ffb75d6de76383afa5f9d61e37704f914059421c/*.mdbackup

    WARNING: Improper use of the sudo command could lead to data loss
    or the deletion of important system files. Please double-check your
    typing when using sudo. Type “man sudo” for more information.

    To proceed, enter your password, or type Ctrl-C to abort.

    Password:
    sudo: /Users/suew/Desktop/iphone backup copy/decodeiphone.py: command not found
    susan-wileys-macbook:~ suew$

  32. stan says:

    Hi Hal! I would appreciate it if you can help me out here…

    I am a first time user for Terminal (I know that it’s not a good idea to mess with it if I don’t know what I’m exactly doing), but it would be great if you can walk me through my problem. Basically, I want to retrieve data from my backup file that I got from Time Machine. I have located the most recent file and copied it onto my desktop. The file name is really long with numbers and letters, and I have added .py at the end of the name (this is something that I thought I would have to do?!).

    I tried using Terminal by following your directions, but it seems that I’m not doing it correctly. Would you mind helping me out here? I lost all my contacts and pictures etc., and would love to be able to at least get some back.

    If possible, a step-by-step process would be greatly appreciated.
    Thanks for your time and for reading this.

  33. Hal says:

    Hi Stan – there may be an easier way for you to get the information back than playing in the terminal. Since I wrote that article quite a lot has happened – have a look here:
    http://menoob.com/iphone/how-to-recover-your-iphone-files-photos-contacts-notes-sms-call-history-etc/

    If you follow the links to ‘iPhone Backup Extractor’ from that post you will download a small app that will automate the process on a Mac (not sure if anything like this exists for Windows yet). When you start the app, click on the link to ‘Read Backups’. A list will appear – choose the date you want and select a destination for the extracted files.

    Once you’ve got that, you can then browse through the contents of the backup and get back pretty much everything. You may find contacts are still in sqllite format. If so, go back to ‘menoob.com’ and scroll down the page until you see a link to sqllite database browser (or click here http://sourceforge.net/project/showfiles.php?group_id=87946&package_id=91778&release_id=414746). This will give you the contents of the database.

    Hope this helps – but big thanks to menoob.com for making it all much simpler!

  34. arvidkarlberg says:

    i deleted my notes by mistake by syncing and clicking on “sync notes” so it erased the notes on my iphone

    all i did was

    connect iphone to my mac

    open itunes

    right click on the (device) the iphone

    restore from backup

    all back to normal again

    hopefully this helped

  35. kellymills says:

    Data lossing from iPhone mobile phone is common problem now a days but if you want to backup your data such as image or photos, songs, videos and many more then you need to best tool for backing up your data that is iPhone backup software. it is the only way to recover your iphone data. off course the page on iphone information is great…
    see other if you want http://www.iphonebackupmac.com

  36. Steve says:

    Can anyone possibly explain WHY this gymnastics would be required of apple would just do their job correctly?

    An iTunes restore is not a restore. It only copies the firmware and apps over. They completely destroy your app data – which is why you own a smart phone. They provide no way of backing it up, restoring it or manipulating YOUR data. That is lame! I think someone needs to class-action these idiots for losing your data when you perform a “backup.”

  37. Arlette says:

    Hi!

    Is it possible to copy an iPhone backup from a PC to a Mac, then restore it? I have all my information/music/backups on my PC but I recently got a MacBook. I dont mind re-importing music from iTunes, but I do want my iphone the way it is with my PC…

  38. NANCY says:

    Hi, I had to restore my iphone and want to recover my contacts … is there any way of doing so?? please let me know…

    thanks.

  39. Benoit says:

    It seems the backup files format has changed, there is no mdbackup file, but MDINFO and MDDATA instead, and they does not seems to be sqllite files.

    I do not have my iphone anymore, but I want my data back !!! I missed to copy data typed in the agenda on last day I used the phone, the rest was hopefully sync with Ms Outlook.

    Apple is really jailing its users in every possible way ! SQLLite was fine for me, and the mddata file are cyphered… If anyone has a solution, I would be really glad

    Arlette, you can just copy entire backup folder from the PC to the Mac (or vice-versa) and erase your iphone, then choose to recover from backup.
    Your old backup should apear in the choices list.

    These folders are located :
    Mac OS X
    ~/Library/Application Support/MobileSync/Backup/

    Windows XP
    C:\Documents and Settings\\Application Data\Apple Computer\MobileSync\Backup\

    Vista
    C:\users\\AppData\Roaming\AppleComputer\ MobileSync\Backup\

  40. Benoit says:

    I’m back. In another blog entry comments I found this link http://sourceforge.net/projects/iphoneanalyzer/
    It’s java software (run on both mac and PC) that decypher the backup files and let you get down into SQLLite database ! I recovered my very important meeting date, sun’s shining :)

    I see any data I got in my iphone, configuration parameters, etc. It has few minor bugs (slowdowns) but it was very helpful to me and I hope it can help others !

  41. Zignguy says:

    Just got iPhone 4, everything fine the first few days, now all my contacts are mixed together, phone #’s & email addresses under wrong names etc.
    Already tried to restore contacts from computer but still the same.
    When I check the computer all the contacts are correct.
    Any suggestions?

  42. There are Recover photos from Memory Stick software on applexsoft.com website.

  43. jg says:

    i I have a problem i was hoping someone here could solve. I bought an iphone a year ago and synced it to my laptop which had thousands of pictures but no music. That laptop crashed and now the only way I can access my photos is to view them on my iphone. I have since backed up my iphone to my new laptop but I have no idea how to access the pictures i have on my iphone on my laptop. I’m afraid to sync the phone with my new laptop because I’m afraid 2lose my pictures but i desperately need songs on it! please help!!! And if it helps i had an hp laptop with windows and the new one is the same

  44. Jess says:

    Hi jg,

    Ultimately, iTunes will never back-up media data only to a back-up, so you should be able to do some searching and find the photos. However, you may also be able to access the phone as a camera, which would allow you to copy the photos to whatever location you wish. I’ve done this with an iPod Touch in that past and it worked well.

    I agree that you should confirm you have the pictures before you do anything else with the phone. Creating a back-up before you re-synch would only serve to store the photos on the back-up, in which case, you would have to go through all this.

    Hal,

    Admittedly, I am not the most proficient in the world with Windows, but I can’t seem to get access to the back-up on the Windows side. I am going to move over to the Mac side and give it a try (it seems easy enough), but I don’t think it can be done the same way with Windows. Perhaps some clarification for our Windows friends here (this page came up first when I entered “access iphone back-up” into google, so there’s that). Anyways, I’ll do some research and playing around and, should I find a way on Windows, I’ll update here.

    Also, I’ll give iPhone Analyzer a try.

    J

  45. Jim says:

    This is a great tutorial

    http://www.sync-iphone.com/notes-2/sync-iphone-notes.html

    on how to Backup iPhone Notes

  46. Janell says:

    I’m in need of some help….My laptop WINDOWS PC crashed I don’t plan on fixing the thing…but my Iphone backup file is on the drive and I WANT IT! Does anyone know how I can go about getting it from my drive without breaking the bank for one file?!! THANKS!

  47. Jess says:

    There is no way to recover the back-up without dealing with expensive hard drive recovery that would, frankly, most likely not be able to recover a file that complex (I have never had luck with those kinds of files).

    The good news is, when you plug your iPhone into a new computer, you should then be able to transfer any iTunes content purchased on the iPhone over to the new iTunes and the rest of the data will be fine.

    Also, take an industrial drill to that old hard drive no less than five times before you get rid of the old computer.

    Now, I’m certain you have heard this a thousand times at this point, but back-up is simply the single most important thing you can do to protect yourself from data loss. That said, this has happened to everyone, at some point.

  48. sbot says:

    Hi hal;
    Thanks for the great tutorial

    However, i’m still facing the same issue of not having .mdbackup files but .mddata and .mdinfo files instead. tried running those but i can only do it one at a time and they all say no text to output.
    p.s. i’m doing this for an ipod touch

    thanks for the help!

  49. Hal says:

    Sbot – are you using mac or PC? The data files are inside the backup files usually. You should be looking for the backup folder itself. On a mac you’ll find it at: /Library/Application Support/Mobile Sync/Backup

Leave a Reply

Your email address will not be published. Required fields are marked *

*

* Copy this password:

* Type or paste password here:

12,347 Spam Comments Blocked so far by Spam Free Wordpress

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>