Skip to content

Instantly share code, notes, and snippets.

@AFutureD
Created June 5, 2026 15:20
Show Gist options
  • Select an option

  • Save AFutureD/2586b99bce65c123e0ccd37d8990483d to your computer and use it in GitHub Desktop.

Select an option

Save AFutureD/2586b99bce65c123e0ccd37d8990483d to your computer and use it in GitHub Desktop.
PLISTBUDDY="/usr/libexec/PlistBuddy"
ENT_PLIST="${TMPDIR}/Debug.entitlements"
# 1) Create the file if it doesn't exist (as a valid plist with an empty dict)
if [ ! -f "$ENT_PLIST" ]; then
/usr/bin/plutil -create xml1 "$ENT_PLIST"
# "$PLISTBUDDY" -c "Add : dict" "$ENT_PLIST" 2>/dev/null || true
fi
# 2) Update if it exists; otherwise add it
if "$PLISTBUDDY" -c "Print :com.apple.security.get-task-allow" "$ENT_PLIST" >/dev/null 2>&1; then
"$PLISTBUDDY" -c "Set :com.apple.security.get-task-allow true" "$ENT_PLIST"
else
"$PLISTBUDDY" -c "Add :com.apple.security.get-task-allow bool true" "$ENT_PLIST"
fi
codesign --force --sign - --entitlements $ENT_PLIST "$TARGET_BUILD_DIR/$FULL_PRODUCT_NAME"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment