How to delete a locked app using superuser privileges? Recently, I was trying to get software that re-maps my mouse's buttons. I stumbled upon a software named Karabiner-Elements, which has the ability to do many things relation to keybindings. After downloading I learned that it was not the software for me, and decided to manually delete it.
However, the application was &quot;Locked&quot;, and I was unable to remove this lock, either from the inspector or the command line using chflags nouchg file, which I found linked to another  post

how to delete a locked app

I even tried the sacred sudo rm -rf, and was unable to remove it.  The answer on that post was using the uninstaller that I stupidly ignored, and this worked.
However, I am still curious as to how an installed software was able to embedded itself so deeply into my computer that I was unable to delete it. I tried ls -lO which returned drwxr-xr-x  7 root  wheel. I am not sure what this means, other than the only way to delete this folder is through root. This leads me to my questions.

How was this software able to lock itself?
How would I go about deleting this software without using the uninstaller?
Is this a potential security risk on UNIX devices?

Thank you for your time.
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.