I have an app that installs a DriverKit system extension when it launches.
If I then drag this app to the Bin from /Applications then I am prompted about that the app also manages a system extension and that the system extension also will be removed.
I would like to have an uninstaller that removes the app. I have tried to remove the app in the uninstaller with rm -rf, but then the system extension is not removed.
I have also tried the trash terminal utility (can be installed with brew install trash) to check if something similar could be used from the uninstaller, but without luck.
Is there a way to programmatically remove an app and also the system extension that the app installs.
Good question! I don't have a fully baked answer, but enough suggestions to try that they won't fit in a comment, so here goes anyway:
systemextensionsctl uninstallcommand. Unfortunately, this will always pop up an authentication dialog, even if you run it with root privileges. But depending on what you're doing, that might be preferable to the above.