Posted by Curtis

How to fix a damaged iTunes library

The dreaded exclamation points in your iTunes library! Edited metadata that doesn't show up outside of iTunes! Most of us have had at least some of these issues, and if you're unlucky most or all of your library can end up like this. Maybe you moved your library from one hard disk to another, you had to get your library back from an old backup, or maybe your disk was failing and this is what you got after running recovery software.

iTunes works really hard to try and fix these problems, but if you're reading this it means that you're running into problems that iTunes couldn't automatically work out on its own. No matter how your library became a frustrating mess, there's almost always something you can do to get your library happy again. Below are a number of different suggestions, each with its own upsides and downsides.

Note that if you're on Windows and your iTunes isn't showing its menu (it doesn't by default), turn it on with Ctrl+B now.

Another important note: There are a couple of features in iTunes that are on by default on Mac but are normally off on Windows. If you're unfamiliar with them, you probably should have them turned on, as they will help keep all of your music tidy going forward. In File > Preferences > Advanced, you should allow iTunes to Keep iTunes Media folder organized and Copy files to iTunes Media folder when adding to library.

You don't need to do this, but it will make your life easier and will help prevent problems in the future. That said, if your library is huge and some of it is stored on an external drive (i.e. you don't have room for all of your music files to be stored on a single volume), you are an exception and should not turn on the “Copy files to iTunes Media...” feature.

Solution #1: Reorganize your iTunes library

This is a simple way to tell iTunes to have a look at every single song in your library, try and find it, and move it into a nice folder structure if it isn't already. From the iTunes menu, select File > Library > Organize Library....

Turn on Consolidate files, and if your library is rather old you can also turn on Reorganize files in the folder “iTunes Media”. Click OK and let it do its thing.

There are a number of types of problems that this will not help with, but it's a good first step to take care of some minor issues.

The upside:
  • Works on your entire library all at once
  • Very unlikely to make anything worse
  • Free
The downside:
  • Only fixes minor problems

Solution #2: Rebuild your iTunes library

If reorganizing your library didn't fix all of the issues you have, you can take more extreme measures by completely rebuilding your music library. There's at least a few types of information that will be lost in the process, which may be considered valuable bits of metadata for some folks: star ratings, “Loves”, play counts, and date added. If you can live without that information, this method tries to preserve everything else about your iTunes music library.

The first thing to note is that this method is drastic, and depending on the types of problems you have with your library, it's possible that you can end up worse off than when you began. Thus I very strongly recommend that you back up your existing iTunes folder before going any further, even if it's a mess.

Where is your music library?

You'll need to know where iTunes keeps all of its files. Normally, this is in your (home) > Music > iTunes folder but if you're a bit more advanced you might have set it up to be elsewhere and therefore you likely already know where it is. When you get to it in Finder or File Explorer, you'll recognize it by the .itdb files within. Note that you have either a “iTunes Media” or “iTunes Music” folder in here.

Export your library

Don't worry, you don't need much disk space for this step as you're not exporting your actual entire library, you're only creating a simple database of what is in your library and playlists. In iTunes, choose File > Library > Export Library.... Give it a unique name and save it somewhere like your Desktop.

Remove the database

You now need to remove your existing database files so that new ones can be created from scratch. Quit out of iTunes, then delete any of the following files you saw in the first step: “iTunes Library”, “iTunes Library.itl”, “iTunes Library.xml”, “iTunes Music Library.xml”, “iTunes Library Genius.itdb”. Note that you will not have all of these.

Add the media back in

Now we're adding everything back into a fresh clean library. Start up iTunes again, and don't be shocked that your library is completely empty. Select File > Add to Library..., then choose the “iTunes Media” or “iTunes Music” folder that you saw earlier. This will take a while to import everything back into your library. If you know that you had music stored in several different locations, you will want to repeat this step for each.

Restore your playlists

Now choose File > Library > Import Playlist... and select the database file that you created in the “Export your library” step earlier. Note that you will end up with duplicate smart playlists that you'll later want to remove.

That's it! Your entire library is rebuilt with all playlists preserved, and hopefully all problems gone away.

The upside:
  • Thoroughly fixes many problem types
  • Works on your entire library all at once
  • Free
The downside:
  • Might make some problems worse
  • Loses Star Ratings, Loves, Play Count, Last Played
  • Resets Date Added
  • Not for the squeamish

Solution #3: Use Song Sergeant

A much less stressful method is to use an application created specifically to repair damaged iTunes libraries. It's called Song Sergeant, and when it is launched it will automatically find and scan your music library for a variety of problems, some of which it can silently fix immediately while scanning.


While it's a commercial product, even in its trial mode it will automatically resolve some kinds of problems, and offer to reassociate tracks that were missing their files when it can find them using its own logic. After that, even if you don't want to buy it you can use it to find a variety of other problems that you can then fix yourself.

The upside:
  • Almost entirely automatic
  • Safe and simple to use
  • Free for some problem fixing
  • Preserves metadata
The downside:
  • Not free to automatically fix some types of problems
  • Fixes other kinds of problems you may not care about

Here are links to download for Mac OS X and Windows.

Final note

Having a broken iTunes library can sometimes make you want to nuke it from orbit and start over. Depending on what is messed up, one of the above methods is almost certainly going to fix it without needing to pull your hair out, and without losing much (or any) music or metadata from your library.