If you tried before to sync your iPhone with more than one computer, you probably had an error message saying that your iPhone is already synced with another iTunes library and asking if you want to erase this iPhone.

There is somewhat of an easy hack for this that Andrew Grant explains on his blog. You will need some basic hacking skills for this (I’m no hacker and I was able to do it). Andrew also lists editing tools that you will need to download: UltraEdit for PC, and HexEdit for Mac.

Basically, the process takes 3 steps:
  1. Backup your library
  2. Find your iTunes library ID
  3. Change your library ID
1. Backing up your library
On the additional computer you want to sync with, backup “iTunes Music Library.xml” and “iTunes Music Library” (you can find these in your iTunes folder in your “My Music” (on XP) or “Music” (on Vista) or in your “Music” directory on Mac) to a safe location. These are the files you will be modifying.

2. Find your iTunes Library ID

On the computer that currently syncs with your iPhone, open “iTunes Music Library.xml” with any text editor and look for the entry between the tags, after “Library Persistent ID”. Note that it should be in the first 15 lines of the code. Now copy this entry as you will need it in the next step. You can now close the text editor.

3. Change your library ID

iTunes stores your library info in an XML file and a binary file. You will have to edit both of them. Note that iTunes must be closed. This part is a little tricky so either go to Andrew’s blog or follow directions that I copied from him below:

On the machine you want to sync with open “iTunes Music Library.xml” in a text editor. Again, find the entry between the tags after “Library Persistent ID” and copy this entry exactly. This time you can use the clipboard if you wish.

When you have a copy, replace this entry with the one you copied in part 1. Make sure you do not change anything else, and the length of the entry is 16 characters/digits. Save this file and close it.

In the Hex Editor, open “iTunes Music Library” (Tunes Music Library.itl on PC).

Select “Find and Replace” from the Edit menu. Make sure “Hex” matching is selected (not ASCII). In “Find” enter the ID you took a note of in Part 1. In Replace, enter the ID you copied at the start of Part 2. Choose Replace All, there should be one match.
Save this file and close it.