Tuesday, 5 February 2008

How to uninstall Mac Os X packages (.pkg)

Mac OS X keeps track of applications installed via the .pkg native installer in the /Library/Receipts folder.

.pkgs appear as files in the Finder but in reality are bundles. Apple nicely conceals information on installed files in the .bom ("bill-of-materials") proprietary binary files. But also ships a lsbom command that reads them (and a mkbom to create them).

So, supposing you want to uninstall a .pkg-distributed file (say... cmake) you have to:

1) check that it ships only files and simbolic links
lsbom Archive.bom | less

2) list the files you are going to delete (checking there is no system file!)
lsbom Archive.bom -f -l -s Archive.bom | less

3) delete them by hand or with the following command as administrator
lsbom -f -l -s -pf Archive.bom | (cd /; xargs -n 1 rm)

Er, you know in advance that if something goes wrong with the command above you wipe out your entire system, don't you?

Thanks to ths Macworld post


holger said...

good posting man, you saved me a lot of time finding it out myself.


tommyd3mdi said...

You may want to have a look at DesInstaller 3: http://krugazor.free.fr/software/desinstaller/DesInstaller.php