How to create a package uninstaller

Ryan Schmidt ryandesign at macports.org
Tue Oct 18 15:03:09 PDT 2011


On Oct 18, 2011, at 16:54, Michael O'Brien wrote:

> 	I've built my own Portfile to create a metaport of Python(x,y), which is a sort of open-source Matlab replacement.  It consists of about forty packages, most of which are already part of Macports.  When the repository is healthy you can install it like a regular Macport (which it is, it's just not in the repository), and if you don't run Macports on a particular Mac, well, you can just create a metapackage on a Mac that does, and install from the metapackage.
> 
> 	And there's the rub.  The metapackage installs and works just fine, thank you very much, but I've now been asked to come up with a way to UN-install it.  Frankly I don't know how to do this.  The info we need is buried in the metapackage file, obviously, but if the Apple installer puts a log receipt anywhere of what it's done in a format I could use to build something to remove all those files, I've not found it yet.
> 
> 	So, question: If I use Macports to create a package file, or a metapackage file, how can I then create an UN-installer for it?

As was already said, OS X does not include an uninstaller. There are some 3rd-party uninstallers available I think. They read the bom files (bill of materials) the installer leaves behind. On Snow Leopard and later, you can find the bill of materials files in /var/db/receipts. On Leopard and earlier, they're in /Library/Receipts.

> I don't want to just blindly remove all of /opt/local.  I just want to remove exactly the set of files that were installed by the (meta)package.

If you distribute a binary package, please create the package from a MacPorts installation whose prefix is NOT /opt/local, otherwise you will interfere with users who want to also use MacPorts.




More information about the macports-users mailing list