TechBuzzPro

Fix a Corrupt iTunes Library - Simple Step-by-Step Guide

· 6 min read · Apps & Browsers

In this article
  1. What You'll Need
  2. Step-by-Step
  3. Common Mistakes
  4. Tips
  5. Troubleshooting
  6. Frequently Asked Questions

Yes, you can fix a corrupt iTunes library by rebuilding its database and, if necessary, restoring the library from a backup. The process replaces the damaged index file, repairs missing or moved media, and restores your playlists so iTunes works again.

What You'll Need

  • A Mac or Windows PC running iTunes (or the Music app on macOS Catalina and later).
  • Administrator access to the computer.
  • A recent backup of the iTunes library folder (Time Machine, Windows File History, or a manual copy).
  • An external drive or USB stick if you plan to move the library temporarily.

Step-by-Step

  1. Quit iTunes completely. On macOS, press Cmd+Q; on Windows, choose File > Exit. This ensures no library files are locked.
  2. Locate the iTunes library folder. By default it lives at ~/Music/iTunes on macOS and C:\Users\[YourUser]\Music\iTunes on Windows. If you have moved the library, open iTunes while holding Shift (Windows) or Option (Mac) and note the path shown.
  3. Create a safety copy. Duplicate the entire iTunes folder to another location (e.g., an external drive). This backup protects you if anything goes wrong during the repair.
  4. Find the database file. Inside the iTunes folder look for iTunes Library.itl (Windows) or iTunes Library.itl (macOS). This file stores the library index and is usually the source of corruption.
  5. Delete (or rename) the corrupted file. Rename it to iTunes Library.itl.bak so iTunes can create a fresh one. Do not delete the iTunes Music Library.xml file; it can be helpful for rebuilding playlists.
  6. Launch iTunes while holding the rebuild key. On both platforms, hold Shift (Windows) or Option (Mac) while opening iTunes. When prompted, click Create Library and point to the original folder. iTunes will generate a new .itl file based on the XML and the media files it finds.
  7. Verify that the library opens. iTunes should start normally, showing your music, movies, and playlists (though some playlists may appear empty). If the app crashes again, repeat steps 4‑6, ensuring the XML file is intact.
  8. Repair missing file paths. If many tracks show a “!” icon, go to File > Library > Organize Library and tick both “Consolidate files” and “Reorganize files in the folder ‘iTunes Media’”. This copies any scattered files into the standard folder structure and updates the database.
    • For large libraries, you can first run File > Library > Get Album Artwork to force iTunes to scan the media folder and refresh metadata.
  9. Manually locate moved files. If you know certain folders were moved outside the iTunes Media folder, use File > Add to Library to re‑import them. iTunes will automatically add them to the appropriate playlists if the XML still references them.
  10. Restore playlists from the XML file. If playlists are missing, go to File > Library > Import Playlist and select the iTunes Music Library.xml. This rebuilds most smart and regular playlists.
  11. Check iTunes preferences. Open Edit > Preferences (Windows) or iTunes > Preferences (Mac) and verify that the iTunes Media folder location points to the correct directory. Adjust if you moved the folder in step 8.
  12. Run a quick health check. Play a handful of songs from different parts of the library. If playback works without error, the core database is healthy.
  13. Back up the repaired library. Copy the refreshed iTunes folder to your regular backup drive. This ensures you have a clean copy in case future corruption occurs.
  14. Optional: Use the Music app (macOS Catalina+). If you have upgraded to macOS Catalina or later, iTunes is replaced by the Music app. The same steps apply; just look for the Music folder inside ~/Music and the Music Library.musiclibrary package.

Common Mistakes

  • Deleting the iTunes Music Library.xml file before rebuilding. The XML is needed to repopulate playlists.
  • Skipping the safety copy. Without a backup, you risk permanent data loss if the rebuild fails.
  • Running iTunes while the .itl file is still open, which can corrupt the new file.
  • Choosing “Create Library” in a brand‑new empty folder instead of the original one; this leaves the media files orphaned.
  • Ignoring the “Consolidate files” step, which leaves references to files that were moved outside the iTunes Media folder.

Tips

  • Keep iTunes up to date before starting; newer versions include bug fixes that reduce the chance of corruption.
  • If you use iCloud Music Library, temporarily disable it (Edit > Preferences > General > iCloud Music Library) while repairing to avoid sync conflicts.
  • Use a wired Ethernet connection when downloading album artwork or iCloud data after the repair; it speeds up the re‑indexing process.
  • Consider splitting a massive library (over 100,000 tracks) into multiple libraries using File > Library > New to reduce future corruption risk.
  • Regularly back up the iTunes folder rather than just the media files; the database is the most fragile component.

Troubleshooting

If iTunes still refuses to start after rebuilding, try the following sequence:

  1. Restart the computer. A fresh reboot clears any lingering file locks.
  2. Check for software updates. Install any pending macOS or Windows updates, then launch iTunes again.
  3. Delete the preferences file. On macOS, remove ~/Library/Preferences/com.apple.iTunes.plist. On Windows, delete %AppData%\Apple Computer\iTunes\iTunesPrefs.xml. Relaunch iTunes to generate a fresh preferences file.
  4. Run iTunes in safe mode. Hold Shift (Windows) or Option (Mac) while opening and choose Open Library without adding any external folders. This isolates the problem to the core database.
  5. Re‑install iTunes. Uninstall the application (Windows: Control Panel > Programs > Uninstall; macOS: drag iTunes to Trash) and download the latest installer from Apple’s official site. Re‑install, then open the repaired library folder.
  6. Restore from a previous backup. If none of the above works, copy the backup folder you created in step 3 back over the current iTunes folder, then launch iTunes.

Always remember that restoring a backup will revert any changes made after the backup date, so keep a note of recent purchases or newly added tracks.

Frequently Asked Questions

Why does iTunes show a “!“ icon next to many songs?

The “!” indicates iTunes cannot locate the underlying file. Re‑building the library or using the “Consolidate files” option updates the paths.

Can I fix a corrupted library without a backup?

Yes. Deleting the .itl file forces iTunes to rebuild the index from the media folder and the XML file, which often restores most of the library.

Will rebuilding the library delete my playlists?

Playlists stored only in the database may disappear, but the .xml file usually contains them. Importing the XML after the rebuild restores most playlists.

Is the iTunes Media folder the same as the iTunes library?

No. The Media folder holds the actual audio/video files, while the library (the .itl file) stores the catalog, ratings, play counts, and playlists.

What if my iTunes library is stored on an external drive?

The steps are identical; just make sure the external drive is mounted and set as the library location in iTunes preferences before you start.

Does iCloud Music Library interfere with the repair process?

It can. Disable iCloud sync temporarily to prevent it from overwriting the rebuilt database, then re‑enable it after you confirm the library works.