How To: Rebuild Your iTunes Library

Update: Since iTunes 12.2, iTunes no longer creates the iTunes Library.xml file, which I mention below, by default. It’s a good idea to tell iTunes to do this, so you can recover your library from that file if necessary. To do this, go to iTunes > Preferences > Advanced, and check Share iTunes Library XML with other applications.

Every now and then, an iTunes Library shows problems. You may have tracks or songs that disappear in the library, but that are still in your iTunes Media folder. Or playlists may change or disappear. Or there may be other, inexplicable problems.

One way to try and fix these issues is to rebuild your iTunes library. I’ve done it from time to time, and, once, it even fixed some issues creating Genius playlists.

It’s a simple process, but one that may take a while if you have a lot of content in your library. Here’s how you do it. (You may not need this page now, but bookmark it for when you do.)

1. Back up your iTunes Media folder. While rebuilding the library doesn’t affect your media files, it’s best to be safe.

2. Quit iTunes, and find your iTunes folder. If you’re on a Mac, it’ll be in the Music folder in your home folder (that’s the one with the house icon and your user name. On Windows, it can be in different locations according to the version of Windows you use:

  • Windows XP: \Documents and Settings\[your username]\My Documents\My Music\
  • Windows Vista: \Users\[your username]\Music\
  • Windows 7 or later: \Users\[your username]\My Music\

The two files you’ll be using are iTunes Library.itl (or, perhaps, just iTunes Library) and iTunes Library.xml.)

Itunes library

3. Make copies of all these files; again, just in case.

4. Move the iTunes Library.xml or iTunes Music Library.xml file to your Desktop or to another folder. You’ll be using this file to rebuild the library.

5. Delete the iTunes Library or iTunes Library.itl file by moving it to the Trash or Recycle Bin.

6. Launch iTunes, and choose File > Library > Import Playlist. Navigate to the iTunes Library.xml file you moved earlier, and click Choose (Mac) or Open (Windows).

iTunes will now examine the XML file, finding all your tracks and playlists, and add them to your library. This will create a new iTunes Library.itl file. If you have a lot of content in your iTunes library, this will take a while. The last time I did it with a library of about 70,000 tracks, it took well over an hour, so be patient.

If for any reason it doesn’t, you can always quit iTunes, delete the newly-created iTunes Library.itl file, and replace it with the one you backed up.

One thing you’ll notice is that all the view settings you applied have changed. You’ll have to go back and reset them the way you want for each playlist. (Choose View > Show View Options to tweak these settings.) But the new library should contain all your media, and all your playlists. Also, the Date Added for all your iTunes content will be the date on which you rebuild the library.

Learn how to get the most out of iTunes with my ebook, Take Control of iTunes 12: