Archive. This is an archive of the Apple Support Community. Discussions are being restored and soon you will be able to read and post here again.

Apple Music Library file cannot be saved when stored on OneDrive in macOS

I have been using OneDrive macOS since March of 2026. I have opted to put the location of the Apple Music Library, ("Music Library.musiclibrary") in OneDrive, specifically ~/"OneDrive/Music/Apple Music", or ~/"Library/CloudStorage/OneDrive-Personal/Music/Apple Music". This ensures that the file is backed up in the cloud. This has worked fine until this past week. Now when I open Apple Music, I get the following error:


The Music Library file cannot be saved. An unknown error occurred (-54).


Note that I have all directories set to “Always Keep on This Device” for OneDrive.


If I move "Music Library.musiclibrary" to a different location that is not on OneDrive and set that in Apple Music, everything works just fine.


I am using macOS 27.2 and OneDrive version 26.189.0928.0007 (26M). The "M" in 26M denotes that this version of OneDrive is using the Native Sync Engine. I believe that when this was updated last week that this is the culprit.


Is anyone else having this problem?

3 replies

Error -54 is an Apple permissions/file-lock error. It means a program is trying to modify a file that is currently open or locked by another process.


Apple Music frequently reads, writes, and modifies the database structure of your .musiclibrary file while the app is active. When OneDrive's Native Sync Engine (CloudStorage framework) intercepts these rapid file modifications to sync them to the cloud, it places a temporary lock on the file. Apple Music hits that lock, cannot save changes, and throws the -54 error.


Even though you have "Always Keep on This Device" selected, the native engine still hooks deeply into the file system to watch for changes, which triggers the conflict.


Recommended Workarounds

Because this is caused by an underlying architectural change in how OneDrive handles macOS file syncing, you will have to change your library configuration to avoid database corruption.


Keep the Database Local, Sync the Audio Files Only (Recommended)

  • Move the Music Library.musiclibrary file back to a local, non-cloud folder (like your default ~/Music directory).
  • You can keep your actual music media files (the actual .mp3, .m4a audio files) inside the OneDrive folder. Apple Music handles cloud-stored media files fine; it just cannot handle its central database file being intercepted.
  • To do this, change the path under Music > Settings > Files > Music Media folder location to point to OneDrive, but leave the library file itself local.


Use a Local Automated Backup System

  • If your main goal is ensuring the library database is backed up, leave the .musiclibrary file local so Apple Music can write to it cleanly.
  • Use an app like Time Machine, or a local file scripting utility (like Carbon Copy Cloner) to copy the .musiclibrary file to OneDrive automatically once a day after the Music app is closed.


Check System Permissions

  • Another user noted that similar permissions-based -54 errors can sometimes be bypassed by re-verifying app privacy permissions. Go to System Settings > Privacy & Security > Full Disk Access, and ensure the Music app has permissions enabled
  • If Music is not there, it can be added with the (+) button at the bottom of the list.



macOS Photos, Music and Final Cut Pro libraries are not supported on cloud-based storage. At least Photos has an official web page about this.


"Make sure that your external storage device, such as a USB drive or Thunderbolt drive, is formatted for Mac: either APFS format or Mac OS Extended (Journaled) format.


You can't store your library on a storage device used for Time Machine backups. And to avoid possible data loss, don't store your library on a removable storage device like an SD card or USB flash drive, or on a device shared over your network or the internet, including over a cloud-based storage service."


https://support.apple.com/en-us/108345



Thank you. I will switch to full disk access to see if that makes a difference.