Uninstall packages in Mac OS X

Solution 1:

Use this command in terminal for check the list of package and uninstalled your files.

$ pkgutil --pkgs # list all installed packages

Once you've uninstalled the files, you can remove the receipt with:

$ sudo pkgutil --forget the-package-name.pkg

After visually inspecting the list of files you can do something like:

$ pkgutil --pkg-info the-package-name.pkg # check the location
$ cd / # assuming the package is rooted at /...
$ pkgutil --only-files --files the-package-name.pkg | tr '\n' '\0' | xargs -n 1 -0 sudo rm -i

Be careful of this last step. The list of directories output by pkgutil --files can include important shared directories like usr, which you don't want to remove.

$ pkgutil --only-dirs --files the-package-name.pkg | tr '\n' '\0' | xargs -n 1 -0 sudo rm -ir

Copied from here (Wayback Machine snapshot of the original)

Solution 2:

I'm modifying @karthikeyan's answer, which didn't work for me.

At a command line, use the following to find the desired package name:

$ pkgutil --pkgs | grep -i {keyword} | less

where {keyword} is a string you expect to see in the package name.

To find the package location (the root directory that all file listings will be relative to), use

$ pkgutil --pkg-info package-name.pkg

Use this to list the package's installed files:

$ pkgutil --files package-name.pkg

After visually inspecting the list of files you can do something like this to remove them:

$ cd / # assuming the package location is /
$ pkgutil --only-files --files package-name.pkg | tr '\n' '\0' | xargs -n 1 -0 -p sudo rm

Be careful of the next (final) step, which removes directories. The list of directories output by pkgutil --files can include important shared directories like usr, which you don't want to remove. -p causes xargs to prompt for confirmation, but don't get trigger-happy. (You should be safe with rmdir too, because it will only remove empty directories. But some people will need to tweak the command line, so it's better to be clear!)

$ pkgutil --only-dirs --files package-name.pkg | tr '\n' '\0' | xargs -n 1 -0 -p sudo rmdir

Once you've uninstalled the files, you can remove the system record of that package:

$ sudo pkgutil --forget package-name.pkg

Sources: pkgutil man page and this post.