You can make a difference in the Apple Support Community!

When you sign up with your Apple Account, you can provide valuable feedback to other community members by upvoting helpful replies and User Tips.

Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

Rebuilding an iTunes Library: How to Do It & What to Expect

When iTunes is performing poorly--sluggishness, weird Podcast updating behavior, etc.--and you have tried everything, the prospect arises of rebuilding the iTunes Library. Instructions are simple. The idea is that the XML Library file will inevitably be "cleaner" than the possibly corrupted ITL file which is the file that iTunes edits in managing your iTunes content, and that after rebuilding your library from the xml file, you will have a fresh, clean ITL file. So, back up your machine. Then, go to your iTunes folder and TRASH the file "iTunes ibrary.itl" in the ~/Music/Tunes Folder. Do not empty the Trash. Also, MOVE the file "iTunes Music Library.xml" to your Desktop. Then start iTunes, select Import in the File Menu and select the iTunes Music Library.xml" that is on your Desktop. It could take hours depending on the size and you can just wait until the automatic rebuild is complete. Incidentally, I strongly recommend that you also disconnect your Mac from the Internet during this entire procedure; more on that later.


Here is the caveat in rebuilding your Library: Apple purposely does not document the ITL file and will only say that most but not all of the information is written to the XML file, a file that technically only exists so that third party applications might be able to work with the iTunes Library. So what information will be missing after you rebuild you library from the XML file? Here is what I found:


i. Music library and playlists: Good news, this remains intact. However, if your ITL file was corrupted you will discover some funny business. For example, there may be items such as Podcasts you have converted to Music files that reappear as Podcast files. You may find that there are files that are missing or files that you know you have, but seem to be missing from the new iTunes Library. There are various utilities or iTunes plugins such as those from the Doug's Applescripts site that will automate the discovery of these and other problems. Also, alas, the Date Added for all files will be today's date and time, not the day and time from as long as 10 years ago.


Your iDeivces (iPods, iPhones, and iPads) will see this rebult library as entirely new. Thus, you will need to decide which Playlists, Artists, etc. to manage/import into each of your iDevices as though they are brand new. Basically, this is a time consuming slog, but you will need to do it. All will be erased and reimported even though they are already on your device. Dumb but there you have it.


Movies, TV Shows, Audiobooks, Books, and Photos: These will remain intact with the same general caveats and iDeivce reimport issues as with the Music files. Namely, you will need to decide what you want to sync anew.


Apps: Here is something that is not included n the XML file. Fortunately, the fix is to simply drag the contents of the Mobile Applications folder into iTunes and drop it. The import will be automatic. However, there may be multiple versions of some of your apps. about which iTunes will warn you and ask for a decision. Unfortunately, the file names of the multiple version apps are not given. So, my technique is to keep the newest version and leave the older one where it is, keeping a list of all of the ones you did not import. After you are done with the import you can go to the Apps window in iTunes, find the imported versions of those files, right click the icon, and then select "Show in Finder." You will then know the file name of the kept file and by inference can identify and decide what you want to do with the other version. In may cases it turns out to be a downrev version that can be moved elsewhere. However, it could also be a version for, say, your iPhone, that does not work with your iPad. In this case, import it and keep it. I would suggest keeping all of the seemingly orphaned apps around for awhile just in case you later find you need them.


Good news: When you connect your iDevice(s) to iTunes you will find that iTunes accepts the apps already installed on them. You need do nothing further in most cases. Wonderful.


Podcasts: Hopefully you heeded my advice to disconnect from the Internet. Because Podcasts seem to be the most problematic of the Library. If connected to the Internet you may, for example, find that the Podcasts will begin to download episodes willy nilly and contrary to your preferred settings. You don't need this right now! So, that said, the Podcasts will be restored including Podcasts that may not currently have any current episodes in them. However, you may find that you will need to Subscribe to some podcasts even though you already had a subscription. In fact, some this having to Subscribe may persist over a few days. Just go ahead and do it of you want the subscriptions. Also, make sure that the Settings for each Podcast are as you like them. You can then connect your iDevice and set it up just as though it is new and iTunes will tediously build your new Podcast library on your iDevice just as with your Music files. Of course you will need to do this for each of your iDevices.


One other thing to watch in connection with Podcasts is your Music section. I ended up with almost 3000 podcast episodes that were not current that were listed in my Music section but greyed out and identified as Streaming content. Rooting these out was a simple matter of selecting for "Genre" and deleting all of the genre "Streaming" from the Library. This list had nothing to do with the settings for Podcasts. It may be a bug or just one of the symptoms of corruption of my particular original ITL file. Notably, I was connected to the Internet when I rebuilt my Library and this is one of the reasons I highly recommend disconnecting before the rebuild. However, this gremlin could occur when you do reconnect. I don't know and I am not about to test for it, So watch for this or for other funny business.


Cloud/iTunes Match stuff: If you had turned on iTunes Match I have no help for you. I have never used it. Intuitively, I suspect this could be an epic mess in the context of rebuilding your Library from the XML file. But maybe not--hopefully not!


iPads, iPhones and the Library: In my case it appears that much of the problem with my iTunes Library file had to do with anomalies and differences betwen what my iTunes Library thought was on a device and what was actually there. Do not be surprised if you feel that you need to restore one of your iDevices. However, prior to doing so consider making an encrypted backup of your iDevice. Encrypted backups include settings and other information that could take hours to reenter and is not included on regular style backups. After a restore, you can be sure that this restoration will be the canonical status of both what is on your iDevice and what iTunes thinks is on your device. Thus you can work with this and then modify it confidently.


Epilogue: For me, this procedure restored performance to iTunes that had been getting steadily worse for about two years. The new ITL file was about 1MB smaller than the old one. Incidentally, even though the ITL fle was modified by iTunes with most major iTunes versions, it traced its provenance back to 2004 when I got my first iPod. That is very long time and so the development of errors and weirdness is not terribly surprising.

Posted on Mar 22, 2014 5:30 PM

Reply

There are no replies.

Rebuilding an iTunes Library: How to Do It & What to Expect

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.