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
-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 com.apple.FinderInfo 32
So in my case it’s the
com.apple.FinderInfo attribute that was causing the problem. As soon as I deleted the extended attribute using
> xattr -d com.apple.FinderInfo 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 com.apple.FinderInfo”. Well, that is something you will have to decide on your own.