This AppleScript Can Check to See if Your iTunes Library is Corrupted

iTunes is little more than a database with a front-end that lets you view its contents, and play the files it manages. As such, it contains a library file, which stores information about your media files. In some cases, this library file can get corrupted, causing a variety of problems.

Doug Adams, manager of Doug’s AppleScripts for iTunes, published a short AppleScript that can check your iTunes library for corruption. As Doug says:

iTunes can seem to behave normally even if there are tracks with corrupted track entry data or corrupted metadata in their files. So you might not even be aware of corruption until a third-party appliance elicits errors.

Go to Doug’s site, run the AppleScript, and check if there are any errors. As Doug explains:

This will error when it finds some badly encoded or improper UTF-8 text, which is often the culprit. Then it’s just a matter of finding the troublesome tracks in iTunes and fixing the problems if possible. Usually this means just editing the tags in iTunes.

6 thoughts on “This AppleScript Can Check to See if Your iTunes Library is Corrupted

  1. Running the commands from Terminal, at least in my case, returns this error: -bash: syntax error near unexpected token `(‘

    I’m not a Terminal expert, but I wonder how the commands know which file to interrogate …

  2. Running the commands from Terminal, at least in my case, returns this error: -bash: syntax error near unexpected token `(‘

    I’m not a Terminal expert, but I wonder how the commands know which file to interrogate …

  3. Some characters need to be escaped–looks like an apostrophe or single quote in your error is the culprit. But also spaces. In Terminal, you would enter something like this:

    xmllint –valid –noout /Users/dougadams/Music/iTunes/iTunes\ Media/Music/Black\ Mountain/Black\ Mountain/Don\’t\ Run\ Our\ Hearts\ Around.m4a

    Using the script allows you to choose a file which then escapes the characters correctly.

    • Damn, that file is wrong. You should use the file path to your iTunes Music.xml file (or it may be named iTunes Music Library.xml), conventionally located in Users/username/Music/iTunes/

  4. Some characters need to be escaped–looks like an apostrophe or single quote in your error is the culprit. But also spaces. In Terminal, you would enter something like this:

    xmllint –valid –noout /Users/dougadams/Music/iTunes/iTunes\ Media/Music/Black\ Mountain/Black\ Mountain/Don\’t\ Run\ Our\ Hearts\ Around.m4a

    Using the script allows you to choose a file which then escapes the characters correctly.

    • Damn, that file is wrong. You should use the file path to your iTunes Music.xml file (or it may be named iTunes Music Library.xml), conventionally located in Users/username/Music/iTunes/

Leave a Reply

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