Removing Munki - munki/munki GitHub Wiki

How to remove the Munki tools and associated files

While an uninstaller is not provided as a package, you can use the commands below to disable the root Munki service and remove all of its components, configuration, and cached data:

sudo /bin/launchctl unload /Library/LaunchDaemons/com.googlecode.munki.*

# uncomment the following line to remove the app path for pre-Munki 2(!), released late 2014
# sudo /bin/rm -rf "/Applications/Utilities/Managed Software Update.app"
sudo /bin/rm -rf "/Applications/Managed Software Center.app"

sudo /bin/rm -f /Library/LaunchDaemons/com.googlecode.munki.*
sudo /bin/rm -f /Library/LaunchAgents/com.googlecode.munki.*
sudo /bin/rm -rf "/Library/Managed Installs"
sudo /bin/rm -f /Library/Preferences/ManagedInstalls.plist
sudo /bin/rm -rf /usr/local/munki
sudo /bin/rm /etc/paths.d/munki

sudo /usr/sbin/pkgutil --forget com.googlecode.munki.admin
sudo /usr/sbin/pkgutil --forget com.googlecode.munki.app
sudo /usr/sbin/pkgutil --forget com.googlecode.munki.core
sudo /usr/sbin/pkgutil --forget com.googlecode.munki.launchd
sudo /usr/sbin/pkgutil --forget com.googlecode.munki.app_usage
sudo /usr/sbin/pkgutil --forget com.googlecode.munki.python

If you remove the launchd jobs as shown above, the user launchagents may still be running even after the above. A simple logout (or even restart) will stop the launch agents. If you'd rather not logout or restart, you might have success stopping the launch agents with code like the following:

currentUser=$( echo "show State:/Users/ConsoleUser" | scutil | awk '/Name :/ { print $3 }' )
uid=$(id -u "$currentUser" 2> /dev/null)
currentUserID="$uid"

# we're running at the loginwindow or otherwise got an empty var somehow, bail forcing exit zero because meh
[ -n "$currentUserID" ](/munki/munki/wiki/--n-"$currentUserID"-) || exit 0
if [ "$currentUserID" -gt 499 ](/munki/munki/wiki/-"$currentUserID"--gt-499-); then
  /bin/launchctl bootout gui/"$currentUserID"/com.googlecode.munki.app_usage_monitor
  /bin/launchctl bootout gui/"$currentUserID"/com.googlecode.munki.munki-notifier
  /bin/launchctl bootout gui/"$currentUserID"/com.googlecode.munki.ManagedSoftwareCenter
fi