[ACCEPTED]-Uninstaller for package on Mac OS X-uninstallation

Accepted answer
Score: 17

There is no standard way of doing this on 18 OS X. Yes, shocking, I know. Apple consistently 17 warns everyone away from package installers 16 (among other things by providing insufficient 15 documentation for them). They then exclusively 14 use package installers for their own standalone 13 apps.... go figure.

Yes, you should include 12 pkgutil --forget.

If your customers are comfortable with 11 this kind of script, then your approach 10 sounds fine. If they want a "double-click-on-it" then 9 you should probably put the uninstaller 8 in /Applications, but avoid that if you can.

If you have 7 a GUI, Status Item, or Preference Panel, then 6 it's nice to put a "Uninstall" button 5 or menu item there rather than requiring 4 them to go mess around with Terminal.

BTW, if 3 you go looking for the Software Delivery 2 Guide, it's been moved for a year or so now, while 1 they "update" it.

Score: 7

the inability to remove packages has bugged 6 me for years, so i've written a tool to 5 uninstall packages:


its a bit better than 4 the shell scripts to do it floating around 3 because it makes sure never to remove any 2 files that are used by any other installed 1 packages

Score: 4

I have a similar application and came across 10 the same issue. The approach I took was 9 one that I have seen other applications 8 use. Rather than simply distributing the 7 .pkg installer, wrap it up in a .dmg file. The 6 uninstall script can be included with the 5 .pkg in the .dmg.

The uninstall script is 4 then renamed to "uninstall.tool". The .tool 3 extension allows users to run the script 2 by double clicking, rather than having to 1 run it from the command line.

Score: 4

The way I solved this was to use Automator, create 9 an application document and then add dialog and script 8 actions. Finally save your Automator application 7 document and you end up with a simple GUI 6 application to run the uninstall.

Often the 5 uninstall action requires administrator 4 privileges - I solved this in Automator 3 by running a shell script action that generates 2 another shell script that can then by run 1 in an applescript action as follows:

on run {input, parameters}
    do shell script "/tmp/uninstaller.sh" with administrator privileges
    return input
end run
Score: 1

Slightly unconventional, but aren't these 3 all. I have Homebrew and cask installed. I 2 was able to uninstall a .pkg with the following:

 brew cask uninstall --force <pkg_name>

ex. brew 1 cask uninstall --force dockertools

More Related questions