Here's the recipe. I'll assume you have a LAN set up already.
- On each computer, go into System Preferences: Sharing: Services, and enable "Remote Apple Events."
- Designate one computer as the "music host;" the other will be the "music client."
- On the client, connect to the host, and mount the hard drive on the host that contains the iTunes music folder. Go into iTunes Preferences: Advanced on the client and set it to use the same folder as the iTunes music folder as the host (the one on the host's computer).
- In the interest of good file management, you probably want to go into iTunes Preferences: Advanced on the host and enable "Keep iTunes Music folder organized" and "Copy files to iTunes Music folder when adding to library." However, on the client machine, I think you will need to disable these (otherwise multiple computers will contend over where and how the files should be organized). If the client already has music files stored locally, relocate those files to the host, and remove them from the client. Add those tracks to the library of the host computer manually.
- Find and remove the files "iTunes Music Library" and "iTunes Music Library.xml" (or create an archive of them) from the folder ~/Music/iTunes on the client machine. Manually add all the tracks on the host machine to the client's copy of iTunes by dragging them into the iTunes window. For very large collections, you should probably do this in chunks (iTunes seems to get confused otherwise). I added all the artists starting with A at once, then B, etc. Took a while, but it worked.
- Now both users have access to the same music directory, can make their own playlists, set their own ratings, load up their own iPod, etc. The problem is that the situation is static--if anyone adds a new track, things get out of sync, and only that user will have access to that track (without additional futzing).
- That is where this mystical-magical AppleScript comes in. This was pretty much written by "deeg" (with some nudging from me) in the Applescript for iTunes forum at iPod Lounge. Copy this script and save it as "sync libraries" to the directory ~/Library/iTunes/Scripts (if you don't already have a Scripts folder there, create it). Relaunch iTunes, and it will be available under the Scripts menu. You can now run this script manually on each computer to update its library against the host. Better yet, use a timed macro (or cron job, which you can set up easily with Cronnix) to launch the script in the wee hours. This assumes that each computer will be turned on when the script executes.
- Assuming that different computers will have different user accounts, you will need to specify the other user's username and password in the "please enter the address" dialog that appears when first running the script. The URL format looks like this:
I'm not sure how to deal with spaces in the computer name (perhaps a backslash before the space); my machines all have one-word names; you can change the computer's name in System Preferences: Sharing.eppc://username:password@machinename.local - Likewise, it should be possible to sync libraries between two user accounts on a single machine using the above format. This probably requires that both users are always logged in (using Fast User Switching).
- This script only works for one host and one client. It should be possible to modify it to deal with multiple clients. I will leave that as an exercise for the reader.

