How To Rebuild Your iTunes Library

Update: Since the release of macOS Catalina, iTunes is no longer available on the Mac. The process below is still applicable to iTunes on Windows. On the Mac, you can manually save an XML file by choosing File > Library > Export Library. But you can no longer do this automatically.

Note: 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 has 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 this from time to time, and it can solve some issues, and has even fixed problems with Genius.

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.

  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, then 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 files

  1. Make copies of all these files; again, just in case.
  2. 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.

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

  4. 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.

299 thoughts on “How To Rebuild Your iTunes Library

  1. Hi there, I have searched and found your article provides a lot of different scenario iTunes Library problem. Let me explain my situation. I would like to transfer my iTunes Library from C Drive to D Drive because C is running low space. I followed
    but the issue is I have placed all my music that actually copied from my friend’s large playlist and he saved it to: C:\Users\Kairyu\Music even after I moved my Library to D drive, I wanted to moved the Kairyu music to D Drive and that is a very large file. Once I moved to D Drive, all my song unable to locate except I manually locating them. I tried the XML music library Find and Replace to correctly pinpoint the path and also remember to only correctly replace all C:\Users\Kairyu\Music to D:\Kairyu\Music\ but still my library and playlist won’t sync properly unless I reset everything back to the original places. The Library can still be in D Drive but my music folder is too heavy to be saved in C Drive. I am lost with all the ways I have tried.

  2. Thank you very much for your article! Rebuilding my iTunes library solved some really weird problems that I was having such as the iTunes window not updating, stopping at the end of each song, and not being able to close iTunes.

  3. Thanks for the great info! It took me over a day to track down a solution to my iTunes v12.5… skipping to the end in the middle of some tracks and this method solved it. Yahoo!

  4. By rebuilding the library, will it eliminate duplicates? Example, today in the media folder I cannot see any duplicates, however in ITunes, I see song duplicates for each album in a single artist. Will rebuilding make this go away?

What do you think?

This site uses Akismet to reduce spam. Learn how your comment data is processed.