Sunday, June 14, 2009

Migrating your iTunes library from Windows to Mac while preserving all your settings

Before starting anything, make a backup of your entire iTunes directory to ensure you have a good copy to go back to in case something goes wrong.

This procedure works for a PC or Mac. But for our interests, I will focus only on a PC to Mac migration. The last time I tried this was a few months back when I migrated everything from my PC to my new MacBook. I assume it still works but if you encounter any issues, please post a note about your experience.

For this migration we will focus on 2 files which need to be updated for this migration.
Microsoft Windows
C:\Documents and Settings\\My Documents\My Music\iTunes\iTunes Library.itl
C:\Documents and Settings\\My Documents\My Music\iTunes\iTunes Music Library.xml

Mac OS X

/Users//Music/iTunes/iTunes Library
/Users//Music/iTunes/iTunes Music Library.xml
The xml file contains all the information about your library to easily share with other applications. While the iTunes Library.itl or iTunes Library file, is a database for iTunes.

  1. So lets begin. First, make sure that iTunes is closed on both machines.

  2. After creating a backup of all your iTunes directories, copy the entire iTunes directory on your PC from the following location:
    C:\Documents and Settings\\My Documents\My Music\iTunes
    To the following location on your Mac:
    /Users//Music/iTunes
  3. Next, you need to update the xml file so that iTunes can locate your media in the new location. Open up the xml file that you just copied to your Mac (/Users//Music/iTunes/iTunes Music Library.xml) with TextEdit or DashCode.

  4. Then go to Edit->Find and search for the current directory:
    "file://localhost/c:/documents and settings/username/my documents/iTunes/"
    ...and replace all instances with the path you plan to store your media:
    "file://localhost/Users/username/Music/iTunes/"

    note: You can assign a different location than the example used above. In my case, I use my NAS server.
    "file://localhost/Volumes/share/MEDIA/MUSIC/"
  5. We are almost done. One last thing is required for the migration to work properly, you need to deliberately corrupt your iTunes Library file:
    /Users//Music/iTunes/iTunes Library
    Open the file in text editor. Do not be worried if the file is not understandable, it is normal. Go to very end of the file and add a few spaces and then save and close.

  6. Now the last thing is to rebuild the iTunes Library file. Open iTunes and wait for the iTunes Library file to be rebuilt automatically. The application will see that the file is corrupt and rebuild it from scratch with the settings in the xml file. This can take time depending on the amount of media you have stored in iTunes. To give an idea, it took me an hour and a half to rebuild my library but keep in mind, my media is stored on a NAS which is much slower to access than the local machine.
Once the file has been rebuilt, you can use iTunes on your Mac just as you did on your PC with all the media in-tact. There is some work involved, but it will save you the time of re-adding all your files manually. In addition, your ratings and playlists are left intact and you can be assured that nothing will be missed whereas you are bound to miss something if you did it manually.

3 comments:

  1. All good until stage 6. ITunes just complained that the library file was corrupt and copied it to a subfolder. It didn't rebuild it. Can't see a way around this.

    ReplyDelete
  2. The fix was simply to copy the Itunes library file from the PC (and remove the itl extension) then force ITunes to open it by double clicking it and choosing ITunes as the application. Then it did the rebuild and everything seems to be ok now.

    Apple really ought to make this easier!

    ReplyDelete
  3. Your article very well and good, bringing inspiration to many. I hope people visit my website.
    Friv 11 | K7x |A10 Online |Firv |Yoob 5 .

    ReplyDelete