Affiliate Disclosure: By buying the products we recommend, you help keep the lights on at MakeUseOf. Read more.
Got that sinking feeling because you’ve just been told your iTunes library is damaged? Don’t panic just yet, you may still be able to recover or fix the problem and access your media once again.
In fact, there are a few different ways that you can try and get your library up and running again. Here’s what to try next.
What Is the iTunes Library?
Before we look at how to fix the library, let’s look at what exactly this file is. In the early days of iTunes, this was an XML file that contained all of the data on your media library. These days, it has a custom file format ITL and is responsible for keeping more than your playlists straight.
The problem is, that if anything happens to this file, iTunes does not open.
You could just create a new Library file and reimport all of your media. Doing so causes all your play counts to reset, and you can lose any playlists that aren’t in your iCloud Music Library. Needless to say, it is important that you fix this file.
Restore the File From Time Machine
This fix assumes you have a working Time Machine backup, and you back up regularly enough not to loose too much data. If you don’t have a Time Machine backup consider setting one up right now, and skip over this step.
You are looking to get the current version of your file back, so the easiest thing to do is delete the damaged one. Navigate to your iTunes media folder under /Users/Username/Music/iTunes/. Find the iTunes Library.itl file, right-click it, and select Rename. Append the file with “old” or “broken” and drag it to your Desktop.
Now click on the Time Machine icon in the Menu Bar and select Enter Time Machine. This will display a Finder window with a timeline running up the side. This timeline is each backup in your Time Machine, go back to your most recent backup and find the library file. Highlight it and click the Restore button.
Depending on how often you add new music or playlists; you may want to go through the backup iterations one by one. Going back a few hours may save you time trying to figure out what’s missing from your library.
Open iTunes with the restored version in place and make sure that everything is working. Once you confirm that iTunes is back to normal, delete the broken file on your Desktop, and you are done. Time Machine is by far the easiest way to fix this error. However, there are other ways.
The Previous iTunes Library Folder
If you do not have a good backup, take this as an opportunity to realize that it’s time get a good backup, either using Apple’s tool or a third party alternative. Thankfully, there is a possibility you can still salvage some of your library. When iTunes makes major changes to your library, it creates a backup in a subfolder: Previous iTunes Libraries.
Repeat the steps to back up the broken copy of the library from the last section under /Users/Username/Music/iTunes/. In the same directory you’ll find a folder titled Previous iTunes Libraries. Once you are in the folder, find the newest version and right click the file.
Copy it and press back to reenter the main iTunes folder. Paste the old version of the file. Right-click the file and select Rename. Remove the date from the end of the file name, make sure that the file is named iTunes Library.itl, and ensure that you include the space in the name.
You should now be able to open iTunes normally. Sadly, there isn’t any normal cadence to this backup. So whatever changes you have made to your library in the meantime are missing. However, if you have iCloud Music Library, you see your “missing” files as cloud files. You can then go through and re-add the local files to your library.
Recreate Your Library
If neither attempt to restore your library file works, your only real choice is to recreate your iTunes library from scratch. Navigate to your iTunes folder and delete the following files: iTunes Library.itl, iTunes Library Genius.itdb, sentinel (you’ll need to have hidden files shown in Finder to see this), and iTunes Library Extras.itdb files.
If you have iCloud Music Library enabled when you open iTunes, it should recreate these files automatically. Once it is open, you need to add your files back. Click File and select Add to Library. Then navigate to your existing iTunes Media folder, highlight it and click Open. iTunes then reimports your existing media files. For media you have outside the normal iTunes folder structure, you need to repeat the import process.
If you do not have iCloud Music Library enabled, you may get an error message asking you to select a folder for your iTunes library. Select your existing library folder and repeat the steps above to re-add all of your media files.
Living the iTunes Life
Almost all Mac (and many Windows) users have hated iTunes at one time or another, and the library file is behind more than a few of those incidents. Having to recreate and re-add media to your library is pretty frustrating. There are programs that promise to “repair” your library, but they seem focused on fixing moved or missing files, not out and out corruption. Once iTunes refuses to open, you are bound to these steps above to get everything working.
With iTunes as the hub for iOS applications, Music, Movies, and TV now, it can be quite a pain to have anything go wrong with iTunes. We’d love to hear from you if you have found a good Mac alternative for the media side of iTunes.
Have you had to overcome iTunes-related problems in the past? Let us know in the comments how you fixed one of Apple’s most-hated applications.