4

I am using PackageMaker for the installer of my application (which is more than a simple bundle). I am wondering how to create an uninstaller, where to install it and how to provide to the user a way to launch it.

Thanks in advance for your help,

AP.
  • 5,205
  • 7
  • 50
  • 94
  • 1
    I won't post this as an answer, as I'm not 100% on it's correctness or validity, but I think most apps that use an installer ship with a script to act as an uninstaller. You should know what your installer installs and where, and as such, you should be able to write and provide a script that removes everything the installer installs. – Jasarien Dec 07 '10 at 13:24

2 Answers2

12

While implementing an uninstaller for some MAC OS application, we've come up with an idea. As SerpicoLugNut says:

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

We deviced that we can watch the Trash, and in case our application appears in the Trash, we can ask a user if he/she wants to uninstall it.

Fortunately, the MAC OS provides an out-of-box functionality to implement this. You just have to put the following .plist to the /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 is run once the user's Trash is modified. This script should check that your application is in the Trash and ask the user if he/she wants to proceed with the uninstall. Of course this can be an arbitrary script or even a binary executable, not only an applescript. For more information, look at the man page for launchd.plist

Oleg Yakovenko
  • 263
  • 3
  • 10
  • I'm unable to create file under the /Library/LaunchAgents at run time, it showing permission denied – PRATHIV Nov 23 '22 at 15:06
2

There is no official un-installation method on OS X. There are apps that will take your app binary, and find the associated files it installs with it, and delete those as well, but apart from those, your only uninstallation options are:

1) Write your own uninstaller script.

2) Use an installer that features un-installation capabilities. I'm not familiar with what the VISE installer has to offer these days, but back in the early days, I remember it had un-installation capabilities.

3) Do what most applications do, and don't worry about un-installation. Seriously - 98% of Mac apps don't offer an uninstaller, and if most people want the app uninstalled, they will just drag the app to the trash, or (if they are slightly more savvy) use an uninstaller app like AppZapper or AppDelete.

TWLATL
  • 2,859
  • 4
  • 25
  • 37