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.

  1. 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.
  2. 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.
  3. 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
  4. In your NEW iTunes Folder backup iTunes Library.itl and iTunes Music Library.xml to a safe location in case you mess things up
  5. 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
  6. In your NEW iTunes Folder rename iTunes Library.itl to iTunes LibraryBAK.itl
  7. Create a new blank file called iTunes Library.itl
  8. Open iTunes – it will think the Library is corrupt and rebuild the Library from your XML file (which now has the old ID)
  9. Wait for it to finish.
  10. 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.

 

Leave a Reply