This is pretty tricky, as there are several files containing iTunes metadata in addition to live running instances of iTunes. The trickiest of these to overcome is the fact that the running instance of iTunes does not write out data until it quits, so if you have running instances on both your iMac and MBP and you update the files underneath them, they will get lost. Further, paths are contained within the files, so this will not work unless you have identical paths on both machines (assuming you have not changed the defaults and have the same username, this would put the music in /Users/username/Music/iTunes/iTunes Music/ and the metadata in /Users/username/Music/iTunes/{iTunes Library,iTunes Music Library.xml}).
You can keep the music folder up to date on both by using rsync, but this only works cleanly if you either always add or delete items on one of the machines or if you only add items. If so, the two lines on the MBP would work:
% rsync -a /Users/<username>/Music/iTunes/iTunes\ Music <G5hostname>:/Users/<username>/Music/iTunes
% rsync -a <G5hostname>:/Users/<username>/Music/iTunes/iTunes\ Music /Users/<username>/Music/iTunes
You'll probably want to set up automatic authentication using public keys auth in SSH and put this in a cronjob.
To accomplish moving the metadata, I suggest you have a script running on both machines under cron which first determines if iTunces is running on the local machine and if it is not, it rsyncs the metadata files from the other server if the content on the other server is newer than that locally. Something like:
if [ `ps -ax | grep -v grep | grep -c iTunes` -ne 0 ] ; do
rsync -au <otherhostname>:/Users/<username>/Music/iTunes/{iTunes\ Library,iTunes Music\ Library.xml} /Users/<username>/Music/iTunes
done
This still assumes that you don't make mods both instances with both instances being up continuously. Also, I have not tested this out, so there are probably some syntax errors or subtleties I'm missing.
This is how I keep both my iTunes and iPhoto libraries synced between 3 Macs. It seems to be pretty dang bulletproof. You'll probably want to use ‘-e ssh’ so that you don't have to have a rsync daemon running separately. – Scott Pack – 2009-07-01T01:15:27.667