EDIT (2018-11-12): Marcel Dopita wrote a post How to restore modified iOS 12 backup which deals with iOS 12. Give that a read if you need to do this procedure for iOS 12.
So you want to replace one or more files inside an iOS 11 device backup made using iTunes, but you
don’t want to pay for a program that does it would rather do this by hand, as it isn’t that hard and you don’t mind getting your hands dirty. So here is the step-by-step guide to replacing files in an iTunes created device backup.
DISCLAIMER: Just in case, make copies where possible in case you mess up the procedure.
Prerequisites: The programs/extensions you will need
- DB Browser for SQLite
- Notepad++ bplist plugin by azerg (should be in the list of available plugins)
Step 1: Navigate to your iTunes backups folder
Pop open File Explorer and go to:
Open whichever folder that has a timestamp that matches when you made the backup in iTunes.
Step 2: Open the file manifest database
Open up DB Browser for SQLite and open
Make sure to keep this open for the whole process as you will need to edit this later.
Step 3: Find the relevant files in the file manifest & extract the relevant metadata
In the Files table, there are four relevant columns: fileID, domain, relativePath, and file. fileID is the hex filename that iTunes has stored the file as on your hard drive, domain is the app domain, which can help you find the right app for the file you’re looking for, relativePath is the path and filename of the file as it is on the device in relation to the domain, and file is a blob containing a binary plist which in turn contains metadata regarding the file.
To locate the file(s) you want to replace, open the Files table, then browse its data. Then, use the filter in the domain and relativePath columns to narrow down the results to the file(s) in question. Once you have it, make a note of the fileID, then use the Edit Database Cell window to export the blob bplist metadata to somewhere. (I recommend giving the exported file a .plist extension so that Notepad++ gives you nice formatting for it thanks to the plugin listed in the prerequisites.)
Step 4: Edit the metadata bplist
This is a quick and easy one. Open the extracted bplist file in Notepad++ and locate the Size key/integer pair and alter the integer to match the size of the new file in bytes, then save the file.
Step 5: Replace the old file with the new file
Using the fileID you took note of earlier, find the file using File Explorer among the 2 digit hex folders (where the folder contains all files starting with those 2 digits), then replace the old file with the new file, making sure to match the same 40 digit hex filename.
Step 6: Update the bplist metadata blob in the file manifest & save the modified file manifest
Again using the Edit Database Cell window for the file column, import the updated binary plist file back into the manifest data. Once this is done, hit Apply, write the changes for the file manifest in DB Browser, and close it.
Step 7: Restore the device from backup in iTunes
As long as everything is in order, this step should go off with out a hitch.
It didn’t work! iTunes won’t restore from backup!
On the 2 devices I tried this on (a dying iPhone 5S and an iPhone 6 plus), the only error I got in the process was the unhelpful “iTunes could not back up the iPhone because not enough free space is available on this computer”. If you get this error, try erasing the device and then restoring the new backup to it, as I suspect it might be the device not having enough room and not the computer; at least that is what solved the issue for me (“Really iTunes, 2 terabytes is not enough room to restore a 4.5 gigabyte backup that is already on the computer?”).
If you get another error, leave a comment and I will update this with a solution if I have one.