Repairing my Music library after Apple Music Library Sync destroyed the metadata

This entry was published at least two years ago (originally posted on August 20, 2021). Since that time the information may have become outdated or my beliefs may have changed (in general, assume a more open and liberal current viewpoint). A fuller disclaimer is available.

Today I finally finished repairing my Music (iTunes) library after it got mangled when I signed up for Apple Music (the service) a few months ago.

Apple Music has its benefits, but apparently signing up automatically activated the library sync feature, which started overwriting my local metadata with data from the cloud. I caught it before it got all the way through and figured out how to turn it off, but a large chunk of my music library lost a lot of the edits I’d made over the years. From song titles to artist names to custom artwork, covering tracks that I’d purchased from the iTunes Music Store, purchased from Bandcamp, ripped from my own CDs, or even imported from my vinyl collection. Titles and names were changes, artwork was either replaced or removed…probably somewhere between a third and a half of my 37,416 item, 285 GB music library was affected.

The only reason I was even able to repair it all was that, well, Music (and iTunes before it) has been historically tweaky for long enough that I’ve gotten into the habit of making a manual backup of my music library every so often, separate from the Time Machine backup that’s done automatically, just because I don’t trust Music not to screw something up at some point.

I also discovered that Music reads metadata from two places: the metadata embedded in the individual files, and in the “Music Library” file stored within the /user/Music/ folder. Much of the bad data that was being displayed in Music was actually being read from the “Music Library” file; apparently that was where the data from the cloud had been written. When I opened the info window on a track to fix it, Music would then read the embedded metadata from the actual track file, and the data (some of it, at least) would switch back to the correct information.

Of course, manually going through and loading every one of my 37,416 tracks wasn’t at all realistic — but the Refresh a track from its file’s metadata script from Doug’s Applescrpts allowed me to select a chunk (I was able to do as many as 600 tracks at at time without it timing out) and let the script repair the metadata in the background. There were still some final corrections that needed to be made (this trick didn’t fix the artwork that got lost or replaced, and many of the “Album Artist” fields still needed to be corrected manually), but those were easier to do once the script handled the bulk of the work.

So, a few months after signing up for Apple Music, I finally have my local library back to a useable state.

Hey, Apple? Local data should NEVER be replaced by cloud data without warning, without explanation, and without active affirmative confirmation by the user. That was years of work I could have lost, and months of work repairing it. Get this bit of your system fixed, please. This sucked.

Also, trying to write a post about my music, the application Music, the service Apple Music, and Apple the company, and make it all coherent, is not an easy thing to do. I get that iTunes was a bloated beast and needed to be split up — though, really, Music isn’t that much better, is still missing a lot of features (like a usable in-app search feature) — but did it have to be renamed so generically?