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):

  1. How to uninstall Mac Os X packages (.pkg)
  2. How to uninstall Mac OS X .pkg packages

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...


3 Responses to “Uninstalling .pkg files on OSX”  

  1. 1 Alex

    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/

  2. 2 corecode

    you can also uninstall .pkg packages with UninstallPKG ( http://www.corecode.at/uninstallpkg/ )

    [full disclosure: yes i am the author]

  3. 3 Rafael

    I had the same problem with a .pkg of a itunes plugin. You can’t unistall using the tradicional app to unistall apps, such app cleaner. I recommed that you use a beta app to clean theses files, it work for me

    1 – Download the UninstallPKG 1.0 beta2, http://www.corecode.at/uninstallpkg/

    2 – Run the app and search for the files you want to delete (unistall)

    3 – Delete using the app (caution, it’s a beta app)

    4 – restart you mac

Leave a Reply

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>



Calendar

April 2010
M T W T F S S
« Jan   May »
 1234
567891011
12131415161718
19202122232425
2627282930  

Follow me

twitter flickr LinkedIn feed

Subscribe by email

Enter your email address:

Archives


Categories

Tag Cloud


Listening