Can you disable a code signature check?

I wrote a patch/utility that disables OS X's default functionality of starting iTunes when the play button is pressed. This utility basically modifies the Remote Control Daemon (rcd) and comments out the Apple Script command to start iTunes. This has worked fine until 10.7, but with 10.8 rcd now has code signature. The patch now causes Exception Type: EXC_CRASH (Code Signature Invalid) after the executable is patched.

Obviously, the code signature checking is working as designed, but I was wondering if anyone has any ideas on what options I might have. Is there a legit way to turn off this check on a single executable? I have tried turning of GateKeeper, but that, understandably, didn't do it.

Any other suggestions for disabling the play button?


Solution 1:

I got the patch to work after running sudo spctl --master-disable. I don't know if there is any way to use spctl to target only rcd though.

Replacing the code signature with an ad-hoc identity with sudo codesign -f -s - /System/Library/CoreServices/rcd.app/ didn't seem to work. Edit: but as mentioned by user48986, it works if you specify the path to the executable, like sudo codesign -f -s - /System/Library/CoreServices/rcd.app/Contents/MacOS/rcd.

Solution 2:

To fix the signature of for example MirrorPro:

sudo codesign -f -s - /Applications/MirrorPro.app/Contents/MacOS/MirrorPro
/Applications/MirrorPro.app/Contents/MacOS/MirrorPro: replacing existing signature