Filed under: iPod Family, Leopard, iPhone
Mission TUAWpossible: Back up your iPhone with Time Machine
Good morning, Mr. Phelps. The man you are looking at is Justin T. iPhoneuser, one of our loyal TUAW readers. Recently, Justin's iPhone went kablooey and when he tried to restore, he found that his backups were corrupted. He lost a great deal of data and time, all because Time Machine hadn't backed up his iPhone's data.
Your mission, Jim, should you choose to accept it, is to help Justin back up his data with Time Machine so he never has to face this kind of data loss again. As usual, should any of your team members be caught by Apple, the Secretary will disavow any knowledge of your actions. This post will self-destruct in five seconds...
[This is the part where the Theme Music usually plays.]
Read on for your TUAWpossible Mission Briefing.
Mission Briefing
Jim Phelps: Team TUAWpossible has learned that Time Machine doesn't automagically back up iPhone data. iPhone backups are stored in your home folder in Library/Application Support/MobileSync/Backup. The folders in that directory store backup data and their manifests for each iPhone or iPod synced to your Macintosh.
TTime Machine's standard exclusions property list specifically tells TM not to back up those folders. Barney, tell us more about the iPhone backup scheme.
Barney Collier: Thanks, Jim. As you already mentioned, iTunes stores all iPhone backup data to the MobileSync backup directory. Each backup contains a signed version of an iPhone file with a master manifest that adds a further layer of authentication to the process.
The reason that 2.0 backups take so long, Jim, is that the iPhone backs up every user file on the phone. And since all Application data is considered user data, the entire app folder is saved for every onboard application. Clearly, Apple made a misstep here since some Applications have massive data components, which must be synced during each and every backup.
Moving on, the manifest file that appears in the backup folder lists every file that was saved by the iPhone. The manifest is then signed using a secure process that involves but is not limited to SHA-1 encryption.
Jim Phelps: Barney, that sounds complicated.
Barney Collier: Yes, Jim. It sure is. Fortunately, it's relatively easy to scan through those files and recover the backed up data. Download a copy of mdhelper to your Mac, make it executable () and run it from the terminal command line. You can search through your backups and recover, for example just sql databases, e.g. chmod 755 mdhelper../mdhelper -C sqlitedb
Jim Phelps: Cinnamon, stop putting on and taking off that mask (geek humor: & 0xff) and tell us about the exclusion list.
Cinnamon Carter: Sure Jim, let me put away this "Space 1999" write up and talk about that. Time Machine's exclusion list can be found on your Macintosh at . This file tells Time Machine which files it should not back up./System/Library/CoreServices/backupd.bundle/Contents/Resources/StdExclusions.plist
Jim Phelps: Can I open that up in TextEdit to take a peek?
Cinnamon Carter: It's a property list, Jim. That means you'll be far better served by opening it in Apple's Property List Editor. This is a standard utility that's included with the Xcode distribution package. Alternatively, you can open it in TextEdit if it has been saved in XML format. You can convert to XML from the command line by issuing the plutil -convert xml1 StdExclusions.plist command.
The file, when opened in Property List Editor looks something like this:
Notice the three kinds of exclusions:
PathsExcluded Time Machine excludes certain kinds of paths from backups. These folders include your Spotlight data, the trash, previous system backups and so forth.
ContentsExcluded The kind of content that TM excludes are drivers, caches and logs. These folders refer to system-level utility data that provide no benefit to the user.
UserPathsExcluded UserPaths are those data items that are stored in your home folder. These folders include both caches and logs used by Safari and Mail as well as -- you guessed it -- MobileSync backups. Rollin will tell you how to edit this to remove the MobileSync backup exclusion.
Rollin Hand: Thank you Barbara, er, I mean Cinnamon. To remove the exclusion involves nothing more than editing the property list. However, there is a snag. The property list is a system item with limited editing permissions. You'll need to edit a copy of the file and then replace the original.
- From the Terminal command line, change directories to /System/Library/CoreServices/backupd.bundle/Contents/Resources/:
- Copy the property list to the desktop.
- Double-click the copied version to open it in Xcode's Property List Editor.
- Select Root > UserPathsExcluded > Item 1. This is a string, the first element of the UserPathsExcluded array. Select it and press the Delete button. Property List Editor removes it from the list. Save your changes.
- From the Terminal command line, from the backupd.bundle/Contents/Resources/ folder, issue the following commands:
cd /System/Library/CoreServices/backupd.bundle/Contents/Resources/
cp StdExclusions.plist ~/Desktop
sudo mv StdExclusions.plist StdExclusionsOriginal.plist
sudo mv ~/Desktop/StdExclusions.plist .
sudo chown root StdExclusions.plist
sudo chgrp wheel StdExclusions.plist
sudo chmod 644 StdExclusions.plst
Should at any time you need to revert to the original version of the file, it is now stored in StdExclusionsOriginal.plist.
Jim Phelps: Thank you, Rollin. That's the end of our mission for today. If you've followed along, you'll have now set up your Mac's Time Machine to back up all iPhones and iPod touches. This can be pretty data intensive -- but it might provide a lifesaving backup just when you need it, and save your top-secret organization from those meddling teenage kids.
Thanks, Alexander Burke


![TUAW [Cafepress]](http://www.blogsmithmedia.com/www.tuaw.com/media/tuaw-cafepress-promo.png)


Reader Comments (Page 1 of 2)
iGO said 3:18PM on 8-21-2008
For the rest of us,
the other 99.8% of us that read TUAW,
this means exactly NO iPhone/iPod-T backups by our Time Machines.
Reply
Ram said 3:47PM on 8-21-2008
Exactly what I thought...
I didn't know TUAW now has comedy writers too.
madgunde said 3:58PM on 8-21-2008
@iGO
Actually, not only does the article explain that Time Machine does not backup your iPhone backups, but it also explains step by step how to remove the iPhone backups from the exclusion list so Time Machine DOES back it up.
iGO said 5:14PM on 8-21-2008
@madgunde
Yeah, we know you're a freakin Genius but the very first step,
(make it executable (chmod 755 mdhelper) and run it from the terminal command line. You can search through your backups and recover, for example just sql databases, e.g. ./mdhelper -C sqlitedb.)
Is Chinese to me and to 99.8% of the readers here, einstein.
Not to mention the rest of the of the "step by step"
Michael Rose said 6:08PM on 8-21-2008
iGO, sorry that you feel like the post is over your head. "string" is a key term if you're going to be editing property lists, and it's not really possible to do without it.
Some posts are highly technical, some aren't.
MacTipper said 6:52PM on 8-21-2008
iGO:
I've written an applescript to do this for you. Here's the download link:
http://www.mediafire.com/?jwd2dyjzjdj
Enjoy!
MacTipper
My Mac-Tipping Blog
Aaron Davies said 8:48PM on 8-21-2008
*This* is why I still come to TUAW. Whiny newbs, grow up and learn to use a computer properly! You're why no one took Mac users seriously for so long.
Max said 5:16PM on 8-21-2008
Bravo! I had been wondering why the backups were taking so long. Great explanation and short tutorial on how to backup my iPhone with Time Machine!
Reply
Von said 3:53PM on 8-21-2008
Nice tip. Although on my Mac the numbering for the items started at zero instead of one, so for me the MobileSync was labeled "0" instead of "Item 1".
Reply
jrobcet said 4:02PM on 8-21-2008
What about doing a complete restore using Time Machine? I've not had an occasion to try it, but are those files also excluded using the “Restore System from Time Machine” option that is available when booted to the Leopard DVD?
Reply
John Bell said 7:17PM on 8-21-2008
If they're excluded from being backed up, then it stands to reason that no, it won't be restored from the Time Machine backup, either.
Frank Ewell said 4:12PM on 8-21-2008
If you want to include theme music in your articles for iPhone users why not make them a short .m4r file that we can drag to iTunes and add to our iPhone. That would be something useful for the rest of us that don't use terminal.
Reply
Americo Savinon said 4:28PM on 8-21-2008
While reading this post from Erica, I remember my time in college when I read the "Head First" book series :)
Reply
c-dude said 5:06PM on 8-21-2008
Nice.
Although, for the non-technical user, it's probably easier to just copy the Library/Application Support/MobileSync folder to your documents folder every once in a while, when you want a real backup. (Perhaps every time you sync, if you're one of the many that only syncs weekly, or less.) Once it's copied there, it gets backed up like everything else.
Reply
Mo said 5:11PM on 8-21-2008
Nitpick…
&& is a logical (not bitwise) and, so isn't a mask
Reply
Snugs said 6:34PM on 8-21-2008
probably would have been a more useful article if the lame attempt at humor was left out. also most aren't familiar with programming language so there was really no need to throw around words like "string" and "array". yes, we all know you're a smart programmer with a phd erica; now can we move on?
Reply
Scott Wallace said 5:23PM on 8-21-2008
The link above for mdhelper is wrong; it should be http://ericasadun.com/ftp/Macintosh/ .
Reply
adin said 5:35PM on 8-21-2008
Here's the real mission impossible: doing something useful with those extracted backups.
For example, I lost all my progress in my games when I had to restore my phone. The phone often crashes or locks when trying to do restores of the backup.
So how do I get my game saves of something like MotionX Poker, Hold 'Em, or DiamondTwister (which usually crashes the phone when I try to reinstall) back on my phone?
Remember, technically, J/B is a nono, so the recently released "backup" J/B app is off-limits, though if there's no other way, J/B can be used in the solution.
Go!
Reply
Jinto.Lin said 12:08AM on 8-22-2008
From what I've seen, jailbreaking is the only option. I've installed the app backup program, but I've not tried it though. but you could also use SSH to backup the game save itself, and maybe use applescript the automate the process. That, and if you jailbreak, you get the cool themes!
Frogmella said 6:33PM on 8-21-2008
Erica, I love your work, but stay away from the comedy. I read that laboured M:I intro and quite frankly couldn't be arsed to click on and read the article. Much love.
Reply