-
-
Save talaviram/1f21e141a137744c89e81b58f73e23c3 to your computer and use it in GitHub Desktop.
#! /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): https://forum.juce.com/t/apple-gatekeeper-notarised-distributables/29952/57?u=ttg | |
# 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 you see `operation not permitted`, make sure the calling process has Full Disk Access. | |
# For example Terminal.app is showing and has Full Disk Access under System Preferences -> Privacy & Security | |
# | |
app_path=$1 | |
if [ -z "$app_path" ]; | |
then | |
echo "You need to specify app to re-codesign!" | |
exit 0 | |
fi | |
# This uses local codesign. so it'll be valid ONLY on the machine you've re-signed with. | |
entitlements_plist=/tmp/debug_entitlements.plist | |
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 :com.apple.security.cs.disable-library-validation bool true" $entitlements_plist | |
/usr/libexec/PlistBuddy -c "Add :com.apple.security.cs.allow-unsigned-executable-memory bool true" $entitlements_plist | |
/usr/libexec/PlistBuddy -c "Add :com.apple.security.get-task-allow bool true" $entitlements_plist | |
# allow custom dyld for sanitizers... | |
/usr/libexec/PlistBuddy -c "Add :com.apple.security.cs.allow-dyld-environment-variables 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 |
Thank you very much for sharing!
However, is it me or the dev_id
doesn't seem to be used in this script?
However, is it me or the dev_id doesn't seem to be used in this script?
Thanks. I've removed this unused dev_id
and add a comment related to current signing.
You're welcome!
Also, is it the only step to do? It doesn't seem to work on my side 🤔
First of all, thanks for making this. However, it fails for me with the following error when trying to resign Ableton Live 11 on macOS 10.15.7:
Re-applying entitlements (if missing)...
/Applications/Ableton Live 11 Suite.app: replacing existing signature
/Applications/Ableton Live 11 Suite.app: resource fork, Finder information, or similar detritus not allowed
codesign failed!
Has anyone encountered this error before? Any insights?
UPDATE:
It turned out to be some extended attributes that needed to be removed first:
xattr -rc "/Applications/Ableton Live 11 Suite.app"
Thanksssssssss!
Hi thanks for a great tool.
When I run it for Ableton Live 10 I get this error:
/Applications/Ableton Live 10 Suite.app: replacing existing signature /Applications/Ableton Live 10 Suite.app: invalid or unsupported format for signature In subcomponent: /Applications/Ableton Live 10 Suite.app/Contents/MacOS/Live.cstemp codesign failed! Removing temporary plist...
What do I do?
Hi,
After applying this script one of the app installed on my system, it says application damaged, any idea what should i do now?
After applying this script one of the app installed on my system
What system app you've used it on??
It's intended for allowing debugging on DAWs. System shouldn't even be possible since Catalina iirc.
Some apps kept some additional system attributes by mistake (xattr -rc )
See this post as an example:
https://gist.github.com/talaviram/1f21e141a137744c89e81b58f73e23c3#gistcomment-3778228
After applying this script one of the app installed on my system
What system app you've used it on??
It's intended for allowing debugging on DAWs. System shouldn't even be possible since Catalina iirc.
Some apps kept some additional system attributes by mistake (xattr -rc )
See this post as an example: https://gist.github.com/talaviram/1f21e141a137744c89e81b58f73e23c3#gistcomment-3778228
it's not a systema app, it's an app downloaded from internet.
i have tried xattr -rc either, even if the code signing process not gives an error though. still getting application crashed.
i'm missing something but what?
May I suggest also adding the com.apple.security.cs.allow-dyld-environment-variables
entitlement. This way you can also debug plug-ins built with address sanitizer by adding
export DYLD_INSERT_LIBRARIES=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/13.0.0/lib/darwin/libclang_rt.asan_osx_dynamic.dylib
to your environment variables. Without this entitlement, any environment variables starting with DYLD_
are ignored.
Thanks @hogliux I've updated the script above.
Semantics, I guess it's not only AUs but any dylib (VST/VST3 included) :) but it's indeed useful.
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.
@talaviram The update to your script is incorrect. It's missing the bool true
at the end of the PListBuddy
command.
ahh. sorry for that. fixed.
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.
@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.
Thanks! This worked nicely for me with the Steinberg VST3PluginTestHost, using my arm64 MacBook Pro on Monterey👌🏻
Does anyone know if this works for auval
?
I copied auval to a user dir and applied the script to it but running it just reports instantly it has been killed.
Does anyone know if this works for auval?
Sadly, auval archs are x86_64 and arm64e. The e
in the arm64e is the tricky part... it means there is pointer authentication so re-applying codesign won't work.
So you can use auval but only under Rosetta. (or.. disable SIP sigh)
Oof.... !
Thanks for the info.
Apple really don't want us to develop solid plugins do they?!
Signing fails on Ventura. /Applications/Ableton Live 11 Suite.app: resource fork, Finder information, or similar detritus not allowed codesign failed!
Signing fails on Ventura.
/Applications/Ableton Live 11 Suite.app: resource fork, Finder information, or similar detritus not allowed codesign failed!
Please see:
https://gist.github.com/talaviram/1f21e141a137744c89e81b58f73e23c3?permalink_comment_id=3222379#gistcomment-3222379
TL;DR - xattr -rc
totally missed that. It worked. Thanks!
Worked beautifully for me on an M1 mac. Thanks!
It doesn't seem to work anymore with Ableton Live 12 (release version) :'(
It doesn't seem to work anymore with Ableton Live 12 (release version) :'(
It'll be helpful to have more details.
Anyway, I don't have Live 12 but the trial version allows re-signing just fine...
Grabbing entitlements from app...
Executable=/Users/talaviram/Downloads/Ableton Live 12 Trial.app/Contents/MacOS/Live
Patch entitlements (if missing)...
Add: ":com.apple.security.cs.disable-library-validation" Entry Already Exists
Add: ":com.apple.security.cs.allow-unsigned-executable-memory" Entry Already Exists
Re-applying entitlements (if missing)...
/Users/talaviram/Downloads/Ableton Live 12 Trial.app: replacing existing signature
Removing temporary plist...
Ah sorry, I forgot.
sudo xattr -rc Ableton\ Live\ 12\ Suite.app
did the trick :)
Having trouble with Mac OS Sequoia and Ableton Live 12 Suite. Live 11 worked just fine, but with LIve 12 I get:
resource fork, Finder information, or similar detritus not allowed codesign failed!
I tried:
sudo chmod 777 /Applications/Ableton\ Live\ 12\ Suite.app/
Operation Not Permitted, with and without sudo
sudo xattr -rc /Applications/Ableton\ Live\ 12\ Suite.app/
Operation Not Permitted, with and without sudo
Anyone else find a way around this?
Did you look at the comment above you? (https://gist.github.com/talaviram/1f21e141a137744c89e81b58f73e23c3?permalink_comment_id=4982316#gistcomment-4982316)
EDIT: Ahh! Do you have enough permissions in Terminal? Full Disk Access and Developer Tools?
Quartz Composer v4.6.2