How to uninstall pkg in macOS

Remove pkg manually

  1. Check the package ID using $pkgutil --pkgs
    $ pkgutil --pkgs
    ...
    com.oll.pkg.CCRuntime
    com.AntiCC.RiD
    com.hciso.AntiCC
    ...
    
  2. Get the location of the pkg you want to delete using $pkgutil --pkg-info <pkg id>
    $ pkgutil --pkg-info com.oll.pkg.CCRuntime
    package-id: com.oll.pkg.CCRuntime
    version: 2023.1
    volume: /
    location: 
    install-time: 1724439281
    
  3. Delete .bom and all the files in the pkg location To delete the .bom files
    $ lsbom -fls  /private/var/db/receipts/com.oll.pkg.CCRuntime 
    

    the .bom files of all the pkg installed are located at /private/var/db/receipts. The install history is recorded at /Library/Receipts/InstallHistory.plist. Then delete all the files in the pkg location

    $ lsbom -fls  /private/var/db/receipts/com.oll.pkg.CCRuntime | (cd /; sudo xargs rm)
    $ lsbom -fls  /private/var/db/receipts/com.oll.pkg.CCRuntime | (cd /; sudo xargs rm -r)
    
  4. Remove the pkg information at the end
    $ sudo pkgutil --forget com.oll.pkg.CCRuntime
    

    Use UninstallPKG

    UninstallPKG is an application that allows you to completely remove .pkg and all their installed contents. Install from Homebrew

    brew install --cask uninstallpkg
    

    or from their website.

Reference: https://kyle.ai/blog/6175.html




Enjoy Reading This Article?

Here are some more articles you might like to read next:

  • DFT Calculations Using Quantum ESPRESSO
  • Longest Palindromic Substring
  • Negative Binomial Distribution