Writing custom uninstaller app for a Mac app

I know it's uncommon for Mac apps to have uninstallers. But in our use-case, we need to have a separate uninstaller app for various purposes, including:

  1. to prompt the user for some information before deleting the app
  2. to stop the app (which is kept running via launch agent with KeepAlive = TRUE), so technically this is to unload or bootout the launch agent (and delete it's plist from ~/Library/LaunchAgents/)
  3. to remove the main app from the /Applications folder (and ofcourse removing its extensions, but I assume that is automatic)
  4. to remove the artifacts that the app has created outside it's container

Please note that the main app is sandboxed, signed by developer id, and contains system extensions.

I've took a look at a couple of other third party apps (eg. AWS VPN Client), which also have a separate uninstaller app. When run, it asks for system admin credentials before proceeding, and then clean up things as expected.

The question is: What is the 'right' way (best practices, APIs, pitfalls etc) to build such an uninstaller app that can do all of the above ?

Hello,

We are also in need of such an app for our in house MacOS app which has a LaunchAgent. Like you said, I have seen the uninstaller app in enterprise apps.

Were you able to find the solution?

Thanks, Sarayoodharan.K

Writing custom uninstaller app for a Mac app
 
 
Q