Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

Uninstall applications installed from packages Install
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.]
    •    
  • Currently 2.05 / 5
  You rated: 2 / 5 (19 votes cast)
 
[57,962 views]  

Uninstall applications installed from packages | 7 comments | Create New Account
Click here to return to the 'Uninstall applications installed from packages' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Uninstall applications installed from packages
Authored by: Sven G on Jan 11, '10 08:12:23AM

In Mac OS X 10.6.x Snow Leopard, however, most package receipts aren't in "/Library/Receipts" in the classic form anymore, but rather - accessible with "Go To Folder..." in the Finder - in the invisible folder "/private/var/db/receipts" (in the form of associated ".bom"s and ".plist"s)...



[ Reply to This | # ]
Caution!
Authored by: boredzo on Jan 11, '10 09:02:00AM

The danger here is that packages don't necessarily install everything anew—a package may replace a file that previously existed. If you remove everything the package installed, you won't restore anything it overwrote, so you'll have broken anything still needs the now-missing components.

In particular, do not use this hint to revert any Apple update.

This even goes for what may seem like just an application update. Many of Apple's applications are built on public and/or private frameworks: For example, many if not most Safari updates also update WebKit, which practically everything requires nowadays. Break WebKit, and any application that uses WebKit for anything—including ones you might not guess, such as Mail and iTunes—will stop working, either partially or completely.



[ Reply to This | # ]
Uninstall applications installed from packages
Authored by: Typhoon14 on Jan 11, '10 01:21:25PM

In addition to already mentioned issues with this approach, keep in mind that a package installer can include scripts that can do pretty much anything. For example, a single component may be copied to multiple locations via a script, existing files may be modified, permissions may be modified, etc. Scripts cannot be run in reverse. In other words, you really have no way of knowing if everything has actually been uninstalled, or what side effects may result. You can always select "show files" from the File Menu when in an installer. Looking at what has been put where and deciding on a case by case basis what is safe or beneficial to remove seems like a better approach.



[ Reply to This | # ]
Uninstall applications installed from packages
Authored by: p32adpg on Jan 11, '10 08:50:17PM

Take care: it's not always "/" (in: "cd /; sudo xargs rm"); you should read the entry IFPkgFlagDefaultLocation from /Library/Receipts/some_app.pkg/Contents/Info.plist.



[ Reply to This | # ]
Uninstall applications installed from packages
Authored by: CarlRJ on Jan 12, '10 03:45:59PM

DANGER WILL ROBINSON!!!

sudo xargs rm is the Mac OS X equivalent of a loaded firearm with the safety off, and this hint, despite the "I haven't tried it with names with spaces" disclaimer, borders on irresponsibility.

If you really know what you're doing, reading through the output of lsbom (along with the associated preinstall / postinstall / preupgrade / postupgrade files) can be useful to figure out how a program gets installed, and thus how to go about removing it. But please, I beseech you, don't ever pipe a list of files that you haven't personally carefully inspected, into something like sudo xargs rm. Don't put a wood chipper in your living room, in place of a wastebasket, either.

And for the record, xargs does choke on spaces:

$ echo "/Library/Application Support" | xargs ls
ls: /Library/Application: No such file or directory
ls: Support: No such file or directory
$

One can get around this particular problem by using the -0 option of xargs:

echo /Library/Application\ Support | tr '\n' '\0' | /usr/bin/xargs -0 ls

But remember folks, Unix gives you enough rope to shoot yourself in the foot. It will, for better or worse, do exactly what you tell it to do, so make sure you really know what you're asking.



[ Reply to This | # ]
Uninstall applications installed from packages
Authored by: nps on May 29, '11 08:18:48PM
A much safer (and interactive) version of this is:

for i in `lsbom -fls /private/var/db/receipts/org.pyside.pyside.bom`; do sudo rm -i "$i"; done


[ Reply to This | # ]
Uninstall applications installed from packages
Authored by: porg on Jun 30, '12 04:56:24PM

Also have a look at:
pkgutil
And its function:
--unlink



[ Reply to This | # ]