Skip to content

Instantly share code, notes, and snippets.

Last active May 24, 2023 14:58
  • Star 68 You must be signed in to star a gist
  • Fork 11 You must be signed in to fork a gist
Star You must be signed in to star a gist
What would you like to do?
Simple Utility Script for allowing debug of hardened macOS apps.
#! /bin/bash
# Simple Utility Script for allowing debug of hardened macOS apps.
# This is useful mostly for plug-in developer that would like keep developing without turning SIP off.
# Credit for idea goes to (McMartin):
# Update 2022-03-10: Based on Fabian's feedback, add capability to inject DYLD for sanitizers.
# Please note:
# - Modern Logic (on M1s) uses `AUHostingService` which resides within the system thus not patchable and REQUIRES to turn-off SIP.
# - Some hosts uses separate plug-in scanning or sandboxing.
# if that's the case, it's required to patch those (if needed) and attach debugger to them instead.
if [ -z "$app_path" ];
echo "You need to specify app to re-codesign!"
exit 0
# This uses local codesign. so it'll be valid ONLY on the machine you've re-signed with.
echo "Grabbing entitlements from app..."
codesign -d --entitlements - "$app_path" --xml >> $entitlements_plist || { exit 1; }
echo "Patch entitlements (if missing)..."
/usr/libexec/PlistBuddy -c "Add bool true" $entitlements_plist
/usr/libexec/PlistBuddy -c "Add bool true" $entitlements_plist
/usr/libexec/PlistBuddy -c "Add bool true" $entitlements_plist
# allow custom dyld for sanitizers...
/usr/libexec/PlistBuddy -c "Add bool true" $entitlements_plist
echo "Re-applying entitlements (if missing)..."
codesign --force --options runtime --sign - --entitlements $entitlements_plist "$app_path" || { echo "codesign failed!"; }
echo "Removing temporary plist..."
rm $entitlements_plist
Copy link

hogliux commented Mar 10, 2022

Semantics, I guess it's not only AUs but any dylib (VST/VST3 included) :) but it's indeed useful.

Yes you are totally right. I've updated my comment just now.

Copy link

hogliux commented Mar 10, 2022

@talaviram The update to your script is incorrect. It's missing the bool true at the end of the PListBuddy command.

Copy link

ahh. sorry for that. fixed.

Copy link

Thanks for creating this tool! Unfortunately it doesn't work for me. I have MacBook with M1, I've tried running the script on Sudio One 4 and disabling the SIP in order to Debug VST3 audio plugin. I see that entitlements are added, but it has no effect. Only when I build the Release version of audioplugin the Studio One sees it.

Copy link

@mpielikis - I suspect your issue isn't related to script. Maybe release builds universal but debug only arm64? S1 v4 was never released as Apple silicon.
Also the script allow debug but isn't related to host scanning.

Copy link

BenLeadbetter commented Oct 28, 2022

Thanks! This worked nicely for me with the Steinberg VST3PluginTestHost, using my arm64 MacBook Pro on Monterey👌🏻

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment