Created
February 20, 2023 18:13
-
-
Save falkoschumann/0b173d08235590353bd82d7146db02c0 to your computer and use it in GitHub Desktop.
Uninstall macOS pkg
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# list all installed packages | |
# > pkgutil --pkgs | |
packageid=$1 | |
set -e | |
cd / | |
pkgutil --only-files --files $packageid | tr '\n' '\0' | xargs -n 1 -0 sudo rm -v | |
pkgutil --only-dirs --files $packageid | tail -r | tr '\n' '\0' | xargs -n 1 -0 sudo rmdir -v | |
sudo pkgutil --forget $packageid | |
echo "Successfully uninstalled $packageid" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment