Codesigned Mac Console app cannot run XojoScript -- solved

I have a Mac Console app that runs XojoScript. The problem was that once I codesign it the app would terminate with a codesign violation as soon as it tried to run the Script. (Keep in mind that Xojo Console apps are not built into a normal app “package” and there is no support for a info.plist.)

The problem is that I needed to include --entitlements <path/to/entitlements.plist> option in my codesign command… where the entitlements.plist file looks like:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
	<key>com.apple.security.cs.allow-unsigned-executable-memory</key>
	<true/>
	<key>com.apple.security.cs.allow-jit</key>
	<true/>
</dict>
</plist>

So my codesigning looks something like:

#!/bin/sh
#remove any resource forks
xattr -cr “path/to/unix/exe”

#CodeSign dylib’s
codesign --entitlements “path/to/entitlements.plist” --timestamp -f -s “Developer ID Application: My Company (xxxxxxxxx)” “path/to/libs/sub/folder/”*.dylib
#additional commands might be needed if there is a lib that does not have a dylib extension

#CodeSign ConsoleApp
codesign --entitlements “path/to/entitlements.plist” --timestamp -f -o runtime --deep -s “Developer ID Application: My Company (xxxxxxxxx)” -i com.mycompany.app "path/to/unix/exe/"myexe

Hope this helps anyone else that runs into this problem.

There is support for Info.plists and it will be required at some point in the near future (according to my contacts at Apple). It currently cannot be done from Xojo and I’m slowly building up the pieces to do this from App Wrapper.

Sam… thanks for the info… I am looking forward to that… and a way to Notarize… which I have not been able to do.