Error -54 can sometimes appear when you edit your Apple Music Library on your Mac. Here's how to get past the issue and back to listening to your music.
If you use Apple's Music app on macOS, you may have encountered error -54 on occasion. This error can occur in response to several actions in Music:
- When adding or removing files to your Music Library
- When adding or editing file metadata in Get Info windows in Music
- When syncing your Music Library to iOS devices
In the first two cases, error -54 is almost always related to permissions errors on the files or folders on your Mac's storage device. This can include permissions on files themselves or on their containing folders.
In fact, the -54 error is one of the oldest errors in the Macintosh filesystem dating back decades as first documented in Apple's book Inside Macintosh: Files:
permErr = -54, /*permissions error (on file open)*/
This is a general file permission error meaning an operation on a file or folder couldn't be completed because filesystem permissions are preventing it.
For example, in Music, if you drag files or folders containing files from the Finder into the Apple Music app's main window, you may have seen error -54 crop up. The same error can happen sometimes if you select files in Music's main window and then hit the Delete key or select "Delete from Library" from Music's contextual popup menu by Control-clicking on an item.
You may also have seen error -54 when you select a file in Music's main window and try to edit its metadata via the Get Info window:
This is usually the same issue as above: locked files, folders, or permissions errors on those items in the filesystem.
To fix both of the above errors, you'll need to change the permissions in the Finder. Then you go back to Music and add or remove your files or re-open the Get Info window and edit the files' metadata again.
To do so in Music, Control-click or right-click the items whose permissions you want to fix, then select "Show in Finder" from the context popup menu. macOS will switch to Finder and reveal the files you selected.
Next, select one or more of the revealed files in Finder, then Control-click on them and select "Get Info from the Finder's popup menu. This opens the Finder's Get Info window.
If it isn't already shown in the Get Info window, turn the small arrow to the left of the Sharing & Permissions section at the bottom to reveal the permissions pane.
A small lock icon appears at the bottom of this pane, in the lower right corner. Click it and enter your admin password to unlock the permissions pane:
Now change the top item ("Me") to Read & Write by clicking on the top line under the "Privilege" label. Close the Get Info window. You can repeat these steps on each file, or on a folder containing items in Finder.
You can tell if a folder is locked or lacks write permissions by opening the folder and looking in the lower-left corner for the pencil icon with a slash through it. If you're not showing a folder's Toolbar then the pencil icon may appear in the window's upper right or lower right corner.
Now you can go back to the Apple Music app and try your operation again. Note in the case of editing file metadata in Get Info windows in Music you may have to close any open Get Info windows and re-open them for the permissions changes to take effect.
Sometimes you may see the same -54 error when you try to sync your Music Library to an iOS device. This is usually in the form of an error such as:
"The iPhone [device name] cannot be synced. An unknown error occurred (-54)."
This can be caused by the same permissions errors as above, or other problems such as the target device being full, a bad USB cable or unstable cable connection, or other problems. Apple technote HT205597 also says this can happen if your Apple Music folder contains files in different locations inside the Music folder on disk.
In this case, you'll need to quit Apple Music, consolidate your files in your Apple Music folder, then open Apple Music and try again. You may need to remove and re-add all the items in Music before you do this.
By default Apple Music stores files in the user's /Music/Media folder - but this location can be changed in Apple Music's Settings window.
Backup and restore
If you still can't resolve error -54 after trying all of the above, there is one latch ditch solution: back up your entire Music folder, delete it from your Mac, and re-add all its content to Apple Music.
To do so, back up your user's Music folder from the Music folder to an external storage device, delete the entire Music folder, restart your Mac, then run the Apple Music app again. This forces Music to create a new Music folder in the user folder with correct permissions.
Finally, copy the contents of your backed-up Music folder into the newly created Music folder in the user folder, then open the Apple Music app and re-add all your content.
If your backed-up content still has permissions locks on it, be sure to unlock everything first using the steps above before copying the files back to your Mac's user Music folder.
Advanced: change file permissions in Terminal
Obviously, if you have a lot of Music content, resetting each file or folder's file permissions in Finder Get Info windows can be quite time-consuming. One alternative is to use Terminal to batch-change file and folder permissions.
Be warned: changing file permissions in Terminal is powerful and if you're not careful you can damage the software on your Mac or even delete files unwittingly.
To bulk-change file permissions in Terminal you use the
chmod is short for change file modes and
chgrp is short for change group. You can read more about how to use both in Terminal by typing
man followed by a space, followed by either command name, and then pressing Return on your keyboard.
chgrp you'll need to know about UNIX file and group permissions which we won't get into here.
Suffice it to say each file or folder in UNIX has an owner, a group, and three sets of permissions: owner, group, and everyone or "world" permissions.
In Terminal, if you type
ls -l and press Return while in any folder, Terminal will list all files and folders and their permissions in the Terminal window:
On the far left are the three sets of permissions for each item in a folder: owner, group, and everyone. If an item has a "d" to the far left it means it's a directory instead of a file or alias.
Permissions on each item for each of the three types can be any combination of "rwx" which means "read, "write", or "execute". There are three sets of them listed, in order in Terminal for the three types mentioned above.
If any of these permissions displays a "-" it means that permission is turned off.
chgrp commands you can change these sets of permissions in Terminal. These are effectively the same permissions as shown in the Sharing & Permissions pane in Finder Get Info windows.
You can also use the
ls command without the
-l flag to display a folder's listing in Terminal with just the item names without all the permissions info.
Error -54 is essentially a file permission error in the filesystem and by using various means to reset the permissions you should be able to resolve it without too much trouble.