What I found was really interesting - it's quite easy to sync your iTunes library, if you have things set up just right.
If you have both your Mac and your PC set to "Keep iTunes Music Folder Organized", then most of the work is done for you.
All you need to do is copy the "iTunes Music" folder from the Mac to the PC, and copy the "iTunes Library" file from the Mac to the PC, but rename it as "iTunes Library.itl"
To make things even easier, you can rename the "iTunes Library" file to "iTunes Library.itl" on your mac, and it will work just fine - then you can do a simple rsync and get everything you need synced across.
The rsync command I use is:
rsync -avz --force --delete --stats --size-only -e ssh --exclude="iTunes Music Library.xml" --exclude=".DS_Store" ~/Music/iTunes/* user@desktop:'~/My\ Music/iTunes/'
You can modify your rsync command yourself. Of note, DO NOT copy the xml file (it's "--exclude"ed), because iTunes on Windows will just recreate it based off of the .itl file. Also, I didn't want to mess up my Windows file structure with all the .DS_Store files (so they are "--exclude"ed as well)
Since I don't care about two-way synchronization (I just want my Windows machine to be a clone of my Mac), this works for me. Hopefully, it's helpful for someone else as well.

13 comments:
Nice work.
I also want to sync my iTunes Library between my Desktop PC and Mac Laptop. I do not want to copy any files however. My iTunes Library is located on an external disk connected to the PC and the Laptop's library root is pointed to this network share on the PC. I could in theory just sync the "iTunes Library.itl" files but the two files are looking for files in different locations. The PC's files look in //Volumes/F:/iTunes Library and the Mac is looking in //Volumes/iTunes Library.
Is there any way to sync these ratings and playcounts from the two libraries without actually copying any .mp3/4 files? My library is well over 100GB and my laptop cannot handle that amount of data!
Umm, how did you get Windows to run SSH?
Winton
I didn't - I have a server (running linux) which my windows machine mounts....that's where I put my files via ssh.
Thanks Nathan!
This looks like exactly what I've been looking for but could you help a scripting newbie out? I don't know exactly how to execute that command (and once I do that I'm hoping to automate it by putting it into the startup and shutdown routines. Unfortunately, I get the following error when trying to run it manually on the directory just above Itunes/Itunes Library:
rsync error: error in rsync protocol data stream (code 12) at /SourceCache/rsync/rsync-24.1/rsync/io.c(359)
Any additional help on this error or where this script should live to run automatically would be most welcome.
Thanks again,
Kevin Q.
oops -
here's the complete error message (cutoff earlier):
ssh: desktop: No address associated with nodename
rsync: connection unexpectedly closed (0 bytes received so far) [sender]
rsync error: error in rsync protocol data stream (code 12) at /SourceCache/rsync/rsync-24.1/rsync/io.c(359)
thanks!
kq
That error means that you are trying to connect to a computer called "desktop" - substitute it with the IP address (or name) of the computer you are trying to connect to.
You'll also want to change the "user" to whatever user name you use to ssh into your machine.
Hi again everyone -
Great news! It looks as though iTunes 7.3 has fixed all the problems in cross-platform compatibility between the Tunes library file iTunes on the Mac and iTunes on the PC work with! This means none of these steps are needed anymore. I have been using a single iTunes Library file AND a single iTunes Music directory for a day now and it works fantastically (or "brilliantly" as we say here in the UK :)). I am able to access my purchased content from both the mac side and the Windows Vista side of my boot-camped MacBook Pro. Those two pieces of data sit in a third partition that is formatted in FAT32.
To do this, all you need to do is:
- restore your library file (I'm not 100% sure which one of the following it is so I just copy all 3: "iTunes Library", "iTunes Library.itl", and "iTunes Misic Library") to a location both Mac and PC can access (I put it in DataDrive:/Music/iTunes/).
- restore the "iTunes Music" folder to a location both Mac and PC can access (I put it in DataDrive:/Music/iTunes/).
- restore the "Album Artwork" folder to a location both Mac and PC can access (I put it in DataDrive:/Music/iTunes/).
- open up iTunes on the mac holding the option key. It'll prompt you whether you want to open a differnt iTunes library. Click "Choose Library" and select the one from the location you put it in step 1 above.
- Go to "Preferences" advanced and select the location for the iTunes music folder where you placed it in step 2 above. I also select "Keep iTunes Music folder organized" and "Copy to to iTunes Music folder when adding to library" because it seems to help keep the mac and PC things in complete sync but you might be able to fiddle with different setting here.
- open up iTunes on the PC (after rebooting) holding the ctrl, alt, and shift keys (I think it's just one of those keys but I don't know which one but holding all of them works). It'll prompt you whether you want to open a differnt iTunes library. Click "Choose Library" and select the one from the location you put it in step 1 above.
- Go to "Preferences" advanced and select the location for the iTunes music folder where you placed it in step 2 above. I also select "Keep iTunes Music folder organized" and "Copy to to iTunes Music folder when adding to library" because it seems to help keep the mac and PC things in complete sync but you might be able to fiddle with different setting here.
This is great news! I hope I gave you enough information to duplicate this functionality. If you find this helpful, please post it on other questions about this that you see.
All the best,
Kevin Q.
This is extremely helpful Kevin. Thanks! Just one question for you, now that you're successfully sharing a single library with mac and pc using the new iTunes 7.3:
Do you have an excessively long "Updating iTunes Library" message every time you open up iTunes from a different OS than the one you used previously? And if so, have you figured out any way around this?
I can see my library (saved on a linux NAS box) no problem from either XP or OSX. And if I use it from an XP machine, close it down, then later use it from another XP machine, it opens with no delay. But if I then open it from OSX, I get a LONG (10 min?) delay while it "updates" the library. Same thing if I go from OSX to XP.
I assume this is rewriting the library each time with the proper format for the new OS being used, but it makes it really hard to use on a regular basis from both XP and OSX. Especially if I want to sync one ipod on the XP machine and another ipod on the OSX machine, then I've got to go through this annoying "updating" process at least twice each day.
Any ideas, Mr. Guru? :-)
I would also like to know how to fix that problem, I want to have one copy of my library on a NAS but I have Macs and PCs, the "Updating iTunes Library" message gets really annoying after a while.
I can't believe all you have to do is change the file ext.... you have saved me so much time... thanks you.
dr.happyman
MUCH thanks!
Another option, especially in cases like the most recent anonymous comment, would be to store your library on an external harddrive. If the hard drive is formatted as DOS, than both your MAC and your PC should be able to read it. If your library file is renamed "ITunes Library.itl" both computers will be able to read it and any changes made will be kept on that drive. The library will automatically be the same regardless of which computer it is hooked up to.
Post a Comment