Friday, September 2, 2011

Syncing your iPhone with multiple iTunes 10 libraries (updated)

Update (May 27th, 2014): 
Since many people seem to try this with iTunes 11, please be advised: I have not tried this with anything else than iTunes 10. Apple tends to change the internal workings of iTunes, especially between major releases. So don't expect this to work on any other version than 10.

Many people commented it doesn't work on 11 anymore. I couldn't test this since I'm not using this hack anymore nowadays, but I wouldn't be surprised if it is indeed so.



After getting a MacBook Air recently, I wanted to use my iPhone with iTunes on that machine. But when you try to sync an iPhone that has been synced with another iTunes-installation, you get an error and are only given the option to clear the library on your iPhone.

I remembered hacks for older versions of iTunes that let you clone the unique ID of one media library to another iTunes installation. The trick was to read the ID from the "iTunes Music Library.xml" of one iTunes-Installation and apply that to both the "iTunes Music Library.xml" and "iTunes Library.itl" (binary) of another installation. Newer iTunes-Versions (v10.4 at least, not sure when it was introduced) were changed to not make it as easy anymore by adding some sort of checksum to the binary file.

To get to the point: it's still possible, by doing the following steps:

1. On source-machibe: get your ID you want to clone (existing iTunes, with which your iPhone is synced)

  • go to your Home-directory -> Music/iTunes
  • open "iTunes Music Library.xml", the ID is in the <string>-tag after the "Library Peristent ID"-<key>.


2. On target-machine: clone ID to another iTunes installation

  • first, close and exit iTunes if it's still running
  • go to your Home-directory -> Music/iTunes
  • open "iTunes Music Library.xml" and overwrite the ID with the one you got from the other library in step 1
  • delete the file "sentinel". It might be hidden, so make sure you have your system set to show hidden files
  • now we need to "corrupt" the "iTunes Library.itl" file. Do this any way you want, I simply did a echo "junk" > iTunes Library.itl but whatever works for you. Deleting it and recreating a text-file with the same name will probably work as well.


3. have iTunes recreate the library

  • now restart iTunes. It should detect that the library is corrupted and will ask you if you want to have iTunes rebuild it. Say yes.
  • Done! Now you should be able to sync your iPhone with iTunes


6 comments:

  1. See, as a Google fanboy I am obigated to rubb your nose into the fact that such things are not a problem on my platform of choice. Android just does not give rats ass about the device it's being synced with. To be honest, I think that iTunes sync problem with its occasional fuckups and datalosses is the biggest downside to owning an iPhone.
    Regards Robert
    (This message was brought to you by my new Samsung Galaxy S2) Verkaufsverbot my ass.

    ReplyDelete
  2. You're a beauty! Hoping it keeps working after updating to iTunes 11. Trying now.

    ReplyDelete
  3. So I've followed these steps, and now my two libraries permanently have the same Persistent ID, but I still can't sync on the second one...

    The only thing I could get to work was at one point using an older method (with a hex editor), I could edit the .ilt file so it would have the same id, and then I could add a playlist to the iPhone if I dragged it as soon as I started iTunes. This method now enables me to always have the same library ID in all relevant files, but I still can't sync.

    ReplyDelete
  4. (note I'm using iTunes 11 on Windows 7 x64)

    ReplyDelete
  5. It DOESN'T work (anymore) on iTunes 11.2 :-(

    ReplyDelete
  6. I couldn’t get this to work on latest iTunes 11, so I ended up copying my iPhone content to iTunes on my other computer using a program called TouchCopy. You can't sync your iPhone on two different computers, but you can copy it to your new computer and then change the computer your iPhone syncs to.

    ReplyDelete