Uninstalling .pkg files on OSX
1 Comment Published April 21st, 2010 in Apple, Opinions Tags: Installation, OSX, Pitfalls, Pkg, Software, Uninstall.I feel safe in managing my tasks on computers when I can always undo last operations and restore a working environment. For that reasons tools like cvs, subversion, git, etc. do exist. But the same should be true with an operating system. You do your stuff, install apps, and when unhappy of the changes you should easily be able to go back in time and have things back working as before. Simple philosophy: avoid (as much as possible) actions that you don't know how to recover, later.
Today I installed an application that was packaged into a .pkg file.
After the try I realized that I may not want to use it anymore, so I tried to uninstall it.
Surprise: there is no SAFE way to uninstall a .pkg file!
Googling around I found those two articles (and more similar ones):
To summarize:
How do you uninstall applications installed using a .pkg installer ?
Well, the truth is other than using third party applications to handle uninstallation there really is no way...
...unless finding out all installed files and deleting them manually. To do so you have to check ".bom" files under /Library/Receipts/ or /var/db/receipts/ using a command like:
$ lsbom -f -l -s -pf /var/db/receipts/com.foo.bar.myapp.pkg.bom
Cool.
Now... is that SAFE? The answer is: NO!
Suppose your bom lists a file - let’s say a library - but that file was already present in the system before of the pkg installation. For example it might be previously existing because some other app was installing the same library. Following this method you will delete a shared library and you will break dependent programs relying on the file you have just deleted.
Notice that, in my case the files listed in the bom was with relative path:
./share/man/man3/gv.3ruby ./share/man/man3/gv.3tcl ./share/man/man3/gvc.3
In my case the files where not installed in the root, but under /usr/local.
At first I decided to go for removal, but after deleting almost everything, I tought that some shared libraries like
./lib/myapp/libxyzplugin.dylib
could be used by other apps, and deleting those files could damage my system causing unpredictable failures in the future.
So I reinstalled the application, and I am gonna keep the zombie files, just to prevent breaking things on my system.
My approach, in installing new programs, is now changed to: if a program is provided with .pkg format, don’t install it unless strictly necessary or it comes with an uninstaller. The eventual uninstaller, might also be verified, to avoid just stupid bare deletes as I was doing creating my own script to automatically delete files listed in the bom.
Now, I really hate this! Coming from Linux and apt packages, I’ll seriously think to kill the next guy who tells me that installing apps in OSX is cool. Once again, Linux rocks where OSX sucks! (and it does sucks also compared to Windows!)
Update
Another way to see the files installed by a package is to execute the command
$ pkgutil --files com.myapp.name.pkg
It is quite disastrous that Apple doesn't came with an app to manage (and uninstall!) such packages...
One Response to “Uninstalling .pkg files on OSX”
Leave a Reply
Search
Calendar
| M | T | W | T | F | S | S |
|---|---|---|---|---|---|---|
| « Jan | May » | |||||
| 1 | 2 | 3 | 4 | |||
| 5 | 6 | 7 | 8 | 9 | 10 | 11 |
| 12 | 13 | 14 | 15 | 16 | 17 | 18 |
| 19 | 20 | 21 | 22 | 23 | 24 | 25 |
| 26 | 27 | 28 | 29 | 30 | ||
Archives
Categories
- Android (3)
- Apple (26)
- Books (7)
- Eclipse (14)
- Errors (3)
- Firefox (7)
- Git (2)
- Hardware (16)
- Horror Code (8)
- Internet (18)
- Java (98)
- JavaScript (9)
- Life, universe and everything (45)
- Lifehacks (25)
- Linux (50)
- Opinions (25)
- OSX (4)
- Python (1)
- Software (27)
- Speeches and Conferences (8)
- Unix (3)
- Web (21)
- Windows (19)
Tag Cloud
Android apple architecture Bash colors configuration CSS Development Düsseldorf Eclipse germany Git Google Hardware hdr How-To Java JAXB job junit Karmic Linux MacBook music night Open Source Opinion oracle OSX patterns Pitfalls Practices Resume Security Software Suspend TDD Testing tip tonemapped Tricks Ubuntu video Web XML
WP Cumulus Flash tag cloud by Roy Tanck and Luke Morton requires Flash Player 9 or better.
Blog License
Blogs I like
Books on the desk
Friends' Blogs
- Antonio Terreno & Valter Bernardini
- Bruno Bossola
- Daniele Galluccio
- Domenico Ventura
- Ed Schepis
- Fabrizio Gianneschi
- Luca Grulla
- Luigi Zanderighi
- Marcello Teodori
- Mida Boghetich
- Muralidharan Chandrasekaran
- Piero Ricca
- Renzo Borgatti
- Simone Bordet
- Simone Bruno
- Uberto Barbini
- Valvolog
- Webtide blogs (Greg Wilkins & Jan Bartel)
Links




















I really like MacOsX, but I have to agree with you… not having an easy uninstall for those packages sucks…
Here I found another article with another solution, not ideal, but better than nothing.
http://www.hexorcist.com/wordpress/2010/12/26/uninstalling-osx-pkg-files/