Sometimes MacOS locks files and you cannot copy, move, or delete them. Here is how to get rid of this "one or more items can't be changed because they are in use" behaviour.

MacOS can be annoying, at times. In this case I was struggling with a video file that could not be copied, moved, or deleted because MacOS persistet on telling me it “can’t be changed because [it is] in use”; cf. this screenshot of the popup message.

The Continue-Button might suggest that MacOS would perform the action if I clicked it. But after clicking continue, I was asked for my admin-password, the file would seemingly get copied (or moved etc.), and finally, the copied (or moved file etc.) would be deleted.

It took a lot of searching until I, finally, came across the solution in this thread. I did not dig into the gory details of the cause but it has something to do with the so-called extended file attributes. You can see if a file has extended file attributes when you do a ls in the terminal. If there is an @ on the right-hand side of the file permissions this file has extended attributes set. As was the case with my video file:

> ls
-rwxr-xr-x@ 1 zzz  staff  42164199 Dec 19 18:58 MAH07541.MP4

Using the -l@ flag we can see the extended attributes that are set for the file:

> ls -l@
-rwxr-xr-x@ 1 zzz  staff  42164199 Dec 19 18:58 MAH07541.MP4	      32

So in my case it’s the attribute that was causing the problem. As soon as I deleted the extended attribute using

> xattr -d MAH07541.MP4

everything was back to normal and the file could be copied, moved, or deleted.

Be careful when you are fiddling with the extended attributes since they can also store resources or essential file metadata. A user in the above mentioned thread says that it is “…always safe to delete”. Well, that is something you will have to decide on your own.

Join the conversation!

  • Hi, is there any way we can apply this using a find and replace method.. I have this attribute in many files on my hard drive and its impossible to find each file and then do this command..

    • Hi, I’m pretty sure that you can achieve this with “find” in combination with the “exec”-option. Unfortunately, I’m not a command line wizard but hopefully you can figure out how to to this with the help of find’s man-page! Good luck! Best wishes, Axel

Leave a Reply

Your email address will not be published. Required fields are marked *