1

I'm using macOS Catalina (10.15.4).

In my /Application folder, I have a file :

localhost:Applications root# ls -al
drwxr-xr-x   3 root      wheel     96 Nov 17 21:42 Karabiner-Elements (之前).app

the characters "之前" is the Chinese word for "previous" or "before" (sorry I cannot find the word in English version). This file is automatically created by OS for duplicate app after I use Migration Assistant to transfer a user account to this Mac.

The file has "Zero Bytes", with only one folder called Contents, which is empty. The /Application/ folder is not locked. I just want to delete the file, but failed, because it's locked. snapshot image: the info of the file

The lock option in general section is gray. The lock icon in the lower-right of the window is also not clickable. The privilege of wheel and everyone cannot be changed, giving the alert: The operation can’t be completed because you don’t have the necessary permission.

I have searched a lot but nothing works. I have tried :

  1. remove to trash, but got :The operation can’t be completed because the item “Karabiner-Elements (之前).app” is locked.
  2. sudo rm got Operation not permitted
  3. sudo chflags -R nouchg got nothing happens, not even error.
  4. sudo chmod 777 got chmod: Unable to change file mode on Karabiner-Elements (之前).app/: Operation not permitted

How can I delete this file?

Giacomo1968
  • 58,727
matrix
  • 111

3 Answers3

2

The answers are within the image you include. The .app file/folder is "Locked" by the Finder, and you do not have permission to modify (or delete) the file.

Try clicking the lock icon in the lower-right of that Get Info window. Hopefully you can enter your credentials and then unlock the file, then delete it.

If it won't let you unlock/delete it, but it accepts your credentials when you click the lock icon, try explicitly giving yourself R/W permission with the "+" symbol in the lower-left.

jimtut
  • 1,714
2

Use these commands in the Terminal:

sudo chflags nouchg,noschg /Applications/Karabiner-Elements.app
sudo chflags nouchg,noschg /Applications/Karabiner-EventViewer.app

The files are locked to prevent an incomplete uninstall, but you can use the commands above to unlock them manually if you're confident you know what you're doing. I unlocked mine so that I could add tags to the files, which I use to sort my apps.

Full info can be found on the Karabiner web site: https://karabiner-elements.pqrs.org/docs/help/advanced-topics/lock-icon/

-1

just in case anyone else was struggling with uninstalling karabiner, I found another thread which explains you must go through their own interface and press the uninstall button. See here - https://apple.stackexchange.com/questions/362662/how-to-delete-a-locked-app-karabiner