How to move your iTunes music library from a PC to a Mac without losing metadata (ratings, play counts, album art, etc.)

I spent the better part of yesterday trying to load my iTunes library on my new MacBook Pro. I was bound and determined NOT to lose all of the metadata associated with my music — star ratings, play counts, playlists, album art, etc. Call me superficial, but I just didn’t want to lose all of that information; information that has been compiled for 3,300+ audio files over the last three years.
Anyway, I eventually got it all figured out, but I thought I’d pass along what I learned. The tutorial below will help you if you DON’T let iTunes manage your Music folder (you can check this setting in Preferences → Advanced → General) and you’re moving from a PC to a Mac. If you don’t mind letting iTunes manage your music, there are easier ways to make the transfer.
I followed this tutorial for the most part, but I got hung up towards the end of the process. So I paraphrased and edited that tutorial to help out people like me (and, presumably, you) who want to switch from a PC to a Mac.
1. Transfer all of your music from the PC to the Mac.
Don’t delete anything — you want all of the same files on both the PC and the Mac. There are lots of ways to transfer your files documented elsewhere, so I won’t cover that here.
It will make things easier if you try to replicate the folder structure on your Mac that you had on your PC. For example, on my PC I had a folder located in D:/Music/ and within the “Music folder” were four sub-folders: “Downloads” (D:/Music/Downloads/), “Full Albums”, “Single mp3s”, and “Owned Albums (mp3 backup)”. When I copied the music to my Mac, I kept the same folder structure, within my new music folder: /Users/jakebouma/Music/. More on this later.
2. Check for up-to-date software.
Make sure that both machines are running the most current version of iTunes. Might seem like a no-brainer, but it’s important.
3. Find and transfer “iTunes Music Library.xml”
On your PC, locate a file called “iTunes Music Library.xml”. By default in Windows, iTunes will place this file in the “My Music” folder. For example, C:/Documents and Settings/Jake/My Documents/My Music/iTunes/iTunes Music Library.xml. If you’re having trouble finding the file, just perform a search.
Making sure that this file is not deleted, transfer it from your PC to your Mac. You can do this many ways, including using a USB drive; I emailed the file to myself.
4. Open “iTunes Music Library.xml” on the Mac.
Using a text editor like TextWrangler (all screenshots will be of this application), open the iTunes Library.xml that you just transferred to the Mac. You can do this by holding ⌘command and clicking on the file.

The next step is where retaining the basic file structure from PC to Mac (Step 1) comes in handy. This file, iTunes Music Library.xml, contains ALL of the metadata associated with the music in your iTunes library (ratings, play counts, album art, etc.), including where it is located on your hard drive. All you need to do is change the file locations in this file to reflect their new location on the Mac to keep all of this vital metadata intact.
Rather than editing this file by hand, which would take hours and hours, you’re going to use the “Find” and “Replace All” function.
5. Find and replace.
First, you need to find the “Location” line of a file. This is the line that tells iTunes where to find the file with which it associates the metadata. In Step 1, I mentioned that one of my folders was called “Owned Albums (mp3 backup)”. iTunes recognizes this file as located at file://localhost/D:/Owned%20Albums%20(mp3%20backup). The %20s denote the use of spaces.

Because all of the files in “Owned Albums (mp3 backup)” on my PC now reside in a similar folder called “Owned Albums (mp3 backup)” on my Mac, all i have to do is change the beginning of the file locations.
Highlight the beginning of the file location, and copy it (⌘command + C). In TextWrangler, click Search → Find or press ⌘command + F to open the “Find & Replace” pane. In the top “Search For” box, paste the text you highlighted (⌘command + V). In the bottom “Replace With” box, enter the beginning of the file location on your Mac. (To find the location of a file on your mac, just ⌘command + click the file, and choose “Get Info”. The location is the line that says “Where”.) Make sure that you add file://localhost/ before the location of the Mac file in the “Replace With” box, or iTunes won’t be able to find your files. Here’s what it should look like (click the image for larger file):

Make sure the “Start at Top” box is checked, and then click the “Replace All” button on the right side.

Voilà! Repeat this as necessary for the number of folders you have. Save this file.
6. Copy and replace “iTunes Music Library.xml”.
Make sure that iTunes is closed and locate the iTunes folder on your Mac. Mine is in Users/jakebouma/Music/iTunes. If you have never opened iTunes on your Mac, there won’t be any files here. If you have, there will be two files: iTunes Music Library.xml (not the one you just edited) and iTunes Library.

Copy and replace the iTunes Music Library.xml in this folder with the iTunes Music Library.xml that you just edited in Step 5. Do not open iTunes yet.
7. Manually corrupt the “iTunes Library” file.
Use a text editor such as TextWrangler to open the iTunes Library file (not the .xml file — see the image in Step 6). Select all of the text (⌘command + A) and delete it. The file should now be blank, with zero characters in it; save it (⌘command + S). iTunes Library’s filesize should now be zero KB (This is important, because some text editors — e.g. UltraEdit — may append invisible characters to the beginning of the file).
If this file is corrupted, which is what the above paragraph details, iTunes will default to iTunes Music Library.xml for all of its information. iTunes will automatically rebuild this file itself, so it’s okay to corrupt it for now.
8. Open iTunes and let it do its thing.
A prompt with a progress bar will come up — iTunes is rebuilding your library. Depending on how powerful your computer is and the size of your music library, this may take a while. When this ends, iTunes will come up with a message saying that the library file was corrupted/damaged and it tried to rebuild things for you. Press “OK” and iTunes will finally launch.
9. Tidy up.
After you’ve made sure that all of your metadata is intact and the files play correctly, you’ll probably want to tidy things up a bit now, such as reformatting your columns in the library and all the playlists and setting the Preferences as you’d like them.
I don’t subscribe to a whole lot of podcasts, so I just went to the iTunes Store and re-subscribed to them all. If you want to keep past episodes, follow the instructions here.
That’s it! You’re done!
10. Reformat your iPod (optional).
If you have an iPod and it was set up on your PC, the iTunes on your Mac will say “Only Macintosh-formatted iPods can be updated” when you plug in your iPod. Your iPod will still sync properly with this message, it just won’t download any new iPod software that Apple releases. To fix this, click “Restore” and iTunes will automatically reformat your iPod for your Mac and re-sync all of your music.
Phwew! Please leave comments if you have any questions or if something was unclear. I wrote this to save people the headache I went through.
Did you enjoy this post? Why not leave a comment below and continue the conversation, or subscribe to my feed to have articles like this delivered automatically to your feed reader. If you don't have a feed reader, you can always sign up for email updates and have fresh content delivered daily to your inbox.


No feed reader? No problem! Subscribe by email to receive daily updates featuring the freshest content from JakeBouma.com!











