One of those annoying “features” of iTunes is that it wants to erase your music library every time you connect it to a different computer. For those of us who move between a couple of different machines every day, this just won’t do. Thankfully, iPhone hacker Andrew Grant put a nice guide together that shows you how to trick multiple iTunes installations into connecting with the same phone without bombing your tunes.
The trick is that each iTunes installation contains a unique ID that’s embedded in both the “iTunes Music Library.xml” and “iTunes Library” files. The former can be edited with a text editor, the latter with a hex editor. It’s as simple as copying the ID from the computer that is synced with your iPhone, and pasting that into the two files in the second computer. You want to save the second machine’s old ID from the XML file, so that you can search for (and replace) that string in the binary “iTunes Library” file. Once you’re done, your iPhone will function correctly on both machines.