Uninstaller for cocoa application

I use PackageMaker to installer my application (this is more than a simple package). I am wondering how to create an uninstaller, where to install it and how to provide the user with a way to start it.

Thanks in advance for your help,

+2
source share
3 answers

When introducing an uninstaller for some MAC OS applications, we came up with an idea. As SerpicoLugNut says:

Seriously - 98% of Mac apps don’t offer an uninstaller, and if most people want the app to be uninstalled, they just drag and drop the app into the trash

We decided that we can watch Trash, and if our application appears in the basket, we can ask the user if he wants to delete it.

Fortunately, the MAC OS provides built-in functions to implement this. You just need to put the following .plist in / Library / LaunchAgents:

<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <key>Label</key> <string>com.your.app</string> <key>WatchPaths</key> <array> <string>~/.Trash</string> </array> <key>ProgramArguments</key> <array> <string>osascript</string> <string>/path/to/your/app/Check Trash.applescript</string> </array> <key>KeepAlive</key> <false/> 

In this example, a Check Trash.applescript run after the user trash changes. This script should check that your application is in the trash and ask the user if he wants to continue uninstalling. Of course, it could be an arbitrary script or even a binary executable, not just applescript. See the man page for launchd.plist for more information.

+6
source

There is no official installation method in OS X. There are applications that will take a binary application and find the files associated with it that it installs with it, and delete them as well, but other than them, only your removal options are:

1) Write your own uninstaller script.

2) Use an installer that has the ability to install without installation. I am not familiar with what the VISE installer has to offer these days, but in the early days I remember that it had the ability to install without the ability to install.

3) Follow what most applications do and don’t worry about uninstalling. Seriously - 98% of Mac apps don’t offer an uninstaller, and if most people want the app to be uninstalled, they simply drag and drop the app into the trash or (if they're a little more savvy) use an uninstaller like AppZapper or AppDelete.

+1
source

The solution would be to create a meta package, not add any packages to it, and then add a script to it that will remove the programs. Most osx applications that need to be uninstalled using the uninstaller have a button that says “Uninstall the application” in the application or help menu

0
source

All Articles