iTunes Help – Moving Your iTunes Library From A PC To A Mac (And Vice Versa)
Originally sourced from LifeHacker.
If you have been solely a Windows-based user of iTunes (or Mac) and you find that you are considering switching, one of your concerns may be the prospect of rebuilding your entire iTunes library and losing all your play counts and ratings.
However, there is a solution.
Warning: This method is NOT prescribed by Apple in any of their documentation, so before you start, BACK UP YOUR MUSIC LIBRARY. Just in case.
On the source machine
To ensure that both machines keep the same folder structure, on the source library, in iTunes’ Preferences pane, the Advanced tab, make sure that “Keep iTunes folder organized” and “Copy files to iTunes Music folder when adding to library” are both checked.
Then, from the Advanced menu, choose “Consolidate Library.” The consolidation process may take some time, depending on the speed of your machine and size of your library.
When that process completes, you’re ready to export your library data. From iTunes’ File menu, choose “Export Library…” and save the Library.xml file somewhere on the destination machine.
On the destination machine
Now it’s time to prepare the Mac, your destination machine. First, create a new iTunes library. (iTunes will do this automatically if it’s the first time you’re launching it; if you want to store your new library somewhere other than the default, hold down the Option key (Shift on Windows) when starting iTunes to create a new library.)
Just like on the source machine, make sure that “Keep iTunes folder organized” and “Copy files to iTunes Music folder when adding to library” are both checked inside iTunes’ Preferences. Make a note of the folder where your new library’s music files will live, and quit iTunes.
Now it’s time to copy your music files from the source machine’s music folder to the destination machine’s music folder. You can do this over the network, or using an external drive. Just make sure the destination has all the same songs as the source.
Convert the Library.xml file from PC to Mac format
Now, the Library.xml file that you exported on the source contains all your music playlists and ratings, but it contains file paths specific to your PC. Macs and PC’s deal with file paths differently; PC’s use drive letters but Mac’s do not. So in order to make it importable by your Mac, we have to find and replace the Windows paths throughout the file with Mac-friendly paths.
To do so, open the Library.xml file in a text editor. If you have a very large iTunes Library, like I do, this file could be several megabytes (19, in my case), so opening it might take more time than usual. If you can, use a machine with LOTS of memory.
Now, you’ll notice that the Library.xml file from a PC will contain, along with a lot of other plain text XML markup, references to music locations in this format: file://localhost/F:/path/to/iTunes/. Using a simple find and replace, change those notations to the destination path using Mac format, for example, file://localhost/path/to/iTunes/. Here’s what my find and replace looked like, from the PC’s F: drive location to my Mac’s external drive named “Media”.
Notice the Mac path does NOT include a drive letter, but the PC does. Replace the /path/to/iTunes/ with the folder’s where your new library lives. Save the edited file. (Depending on the speed of your machine and size of the Library.xml file, this may take a few minutes.)
Make sure you double-check that the source path was correctly replaced with the destination path; if this part isn’t exactly right, you’ll be screwed later on.
Import your Library
Now your new library is ready for all your hard-earned ratings and playlists. Launch iTunes on the destination machine. Even though you copied all the music to the right folder, iTunes doesn’t see it. Yet.
From the File menu, choose “Import…” and select the Library.xml file you exported and edited from the source – then let ‘er go. It will take some time, but iTunes will suck in all the playlists, and tracks with rating information into your new library.
When you’re done, you’ll notice that you have duplicates of standard-issue iTunes playlists, like the Top 25 Most Played, Music Videos, etc. You can delete those dupes. Also, that whole Determining Gapless playback process might take awhile in your new library, too.
One important note: This method successfully transfers all your song ratings and playlists, smart or otherwise. However, it does NOT transfer other metadata, like Last Played and Play Count. This, quite frankly, sucks sideways. (However, using iTunes’ built-in backup and restore to 60 gazillion discs, Play Count IS transferred.) That said…
Congratulations! You’ve transferred your over-sized iTunes library from a PC to Mac. (This works the other way around too, just reverse the file path replacements.)
Come check out the directory for the rest of my iTunes tips!