Skip to content

Instantly share code, notes, and snippets.

@notverypc
Created June 8, 2020 14:50
Show Gist options
  • Save notverypc/dbb1e56315bade6dadbaa3f75012a50f to your computer and use it in GitHub Desktop.
Save notverypc/dbb1e56315bade6dadbaa3f75012a50f to your computer and use it in GitHub Desktop.
Remove Item from SelfServeManifest
!/bin/bash
# See if item is in SelfServeManifest
itemToRemove="R"
ssm_items=$(/usr/libexec/PlistBuddy -c "Print managed_installs" /Library/Managed\ Installs/manifests/SelfServeManifest | /usr/bin/grep -n -w $itemToRemove | /usr/bin/awk -F ":" '{print $1}')
if [ ! -z "$ssm_items" ]; then
# Item to delete is the number minus two
itemToDelete=$(($ssm_items-2))
/usr/libexec/PlistBuddy -c "Delete :managed_installs:$itemToDelete" /Library/Managed\ Installs/manifests/SelfServeManifest
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment