How to fix iTunes “Do you want to erase this iPhone and sync with this iTunes library?”
iTunes is one crazy piece of software. Recently I decided I no longer wanted my Music and Photos under “My Documents” folder in Windows so I moved them knowing I could easily update the iTunes Music path later – which was true, but little did I know that iTunes would recreate it’s Music Library with a new ID and then bar all my devices (iphone, ipad) from Syncing with the Library again.
I was presented with the following error messages:
- The iPhone “iPhoneName” is synced with another iTunes library. Do you want to erase this iPhone and sync with this iTunes library?
- The iPad “iPadName” is synced with another iTunes library. Do you want to erase this iPhone and sync with this iTunes library?
I also received similar messages when trying to re-sync photos, movies, music, books, etc. Don’t click yes as it will remove all your content and re-sync with iTunes. How do you get around this craziness? Well it’s pretty easy if you still have your old iTunes XML file (from your old computer, old drive or backup) and still doable but a bit harder if not.
Firstly some background info you can find your itunes folder usually under /MyDocuments/MyMusic/iTunes. This is where your iTunes Music Library.xml and iTunes Library.itl are stored – these files will be referenced later.
- Open your OLD iTunes Music Library.xml file (from your old iTunes music folder or backup) and near the top you sill see something like this <key>Library Persistent ID</key><string>HEREISYOURID</string> copy your old Library Persistent ID somewhere safe you will need it soon.
- If you don’t have a backup or access to your old iTunes Library file before it switched you can extract the ID from your iPhone or iPad – it’s a bit tricker and is detailed here – in a nutshell you need to backup the device, get the info.plist file and upload it to the previously linked site – the script will extract your ID from the file.
- Assuming you did have a backup/access to old drive/computer and just copied your ID from step one now all you need to do is backup your iTunes Library.itl rebuild itunes and you will be good to go
- In your NEW iTunes Folder backup iTunes Library.itl and iTunes Music Library.xml to a safe location in case you mess things up
- In your NEW iTunes Folder open iTunes Music Library.xml with a text editor and paste your OLD Library Persistent ID over the top of the current one
- In your NEW iTunes Folder rename iTunes Library.itl to iTunes LibraryBAK.itl
- Create a new blank file called iTunes Library.itl
- Open iTunes – it will think the Library is corrupt and rebuild the Library from your XML file (which now has the old ID)
- Wait for it to finish.
- Once you open iTunes it will rebuild any thumbnails and do some other cleanup tasks. But once it’s done you should be able to sync with your devices again without the erase your phone messages.