macOS music app and the additional `music` subfolder

All my music files reside in a folder called /music. However after updated macOS Ventura from 13.0.1 to 13.1 or after updating to Ventura in the first place, there was a change: Suddenly without me changing any setting music app decided to add a subfolder and any new music or music I opted to re-add to the library ended up in /music/music.

My music setup is rather complex, taking all devices and backups into account, which derive from this one mac. So since I received no notice about any change, it took a while to discover this problem. Until then the faulty library structure already had been synced to mobile device, another mac and a backup. I use several backups so a safety net was still in place, but this was already very unpleasant.

I discovered the problem, since Mixxx an open source DJ software refused to correctly work with new music files I had added to the library via music app. That is how I discovered they ended up in that additional music subfolder, and Mixxx expected the files one level higher and so the digging begins.

Understanding the cause

In Apple Discussion 253623929 the famous turingtest2 account mentioned two different Media Organization styles used in Apple’s music app:

  1. Prior to iTunes 9: artist folders would go into the media folder (previously called iTunes Music) with other media types such as Movies, Podcasts and TV Shows getting dedicated subfolders
  2. iTunes 9+: allowing Music to get its own subfolder, and with the media folder name being changed to iTunes Media

Seems like this is related to the issue we are having. They continue:

Older libraries could be converted from the old layout to the new one by selecting File > Library > Organize Library > Rearrange Files. This was a one way conversion. Roll forwards to the release of Music in Catalina and the “new” layout is still in force with music going to <Media Folder>/Music. It makes more sense given Music only supports music to remove this extra layer but this isn’t an obvious way to change. You can however (with Music closed) edit the .Media Preferences.plist file in the media folder and change the integer value from 1 to 0 which will force the older layout. If you then turn keep organized off and back on again all of the content should pop up one level.

We now know that the Media Organization Style used is defined in .Media Preferences.plist which is located in the respective media folder. Remember you can show / hide hidden files by using Shift+Cmd+. in Finder. So we do that and open the plist in our texteditor:

.Media Preferences.plist showing integer value of 1 indicating that Media Organization #2 post iTunes 9 is used

This was a surprise. While I recall migrating to the new library model, I have used this music library for years without the additional music subfolder. Why and how this had changed recently remains a mystery.

Resolving the issue

To resolve the issue:

  1. close music app
  2. edit .Media Preferences.plist integer value to 0, safe file
  3. open music app > settings and disable file organization, then re-activate file organization
  4. re-add all music files

Gone is the music subfolder.

Takeaway

Changing library organization methods is a highly delicate problem. I am only partly blaming Apple here. This is very hard to get right. My pet-theory is, the integer value has been changed by a macOS update and that should certainly not happen. Changing the value after informing users when they opt to Rearrange Files is fair. But interfering with library structure without giving users a choice is a big nono. We will see if the integer value sticks when the upcoming macOS 13.2 update is released next week.

2023-02-13 macOS 13.2.1 does not address this problem.