Uninstall applications installed from packages

Jan 11, '10 07:30:00AM

Contributed by: oblahdioblidaa

If you've installed an application from a .pkg-type installer, Mac OS X keeps a listing of what was installed in the Library/Receipts folder -- either the top-level Library, or your user's Library. The lsbom command can be used to see this list, and to uninstall the application.

First, find the receipt. It will be in either ~/Library/Receipts or /Library/Receipts, as the name of the package. The actual bom ("bill of materials") file is located at, for example,

/Library/Receipts/some_app.pkg/Contents/Archive.bom
Use the lsbom command to see what was installed: lsbom -fls /Library/Receipts/some_app.pkg/Contents/Archive.bom You can use this list to manually delete the items installed, or you can feed the list to rm to delete the installed files. Be sure to examine the list of files before trying to remove them -- this command will only work if the paths are relative to the root directory ("/"), and I haven't tried it with names with spaces.
lsbom -fls  /Library/Receipts/some_app.pkg/Contents/Archive.bom | (cd /; sudo xargs rm)
This will remove any installed files, though directories must be removed manually. I tested this using the Mac package for FontForge, and it successfully removed the program's files. I originally saw this code in this post in a Mac OS X mailing list (from 2002).

[robg adds: I haven't tested this one, and there's a warning in the original mailing list post that notes this may be a bit dangerous due to differences in the .bom structure between different apps.]

Comments (7)


Mac OS X Hints
http://hints.macworld.com/article.php?story=20100107090139622