How to delete a locked app using superuser privileges?

Read the shell script:

/Library/Application Support/org.pqrs/Karabiner-Elements/uninstall_core.sh

or

  • https://github.com/pqrs-org/Karabiner-Elements/blob/master/src/scripts/uninstall_core.sh

In summary:

  • Unload the kernel extensions.
  • Clear immutable flags nouchg,noschg from the apps.
  • Remove the files from /Library and /Applications. Remember we used sudo with the script.
  • Refresh kernel extension cache: kextcache.
  • https://github.com/pqrs-org/Karabiner-Elements/blob/master/src/scripts/uninstall.sh
  • Kill all orphan/ background processes if any.
  • Prompt you to restart the computer.