What is the proper way to create and distribute a makefile+clang compiled command-line binary tool so that Gatekeeper on a recipient's Mac running Catalina will allow the binary executable to run from the Terminal? Given I have a Developer ID, is there a way to Notarize some sort of container for the binary to allow the extracted command-line tool to be run?
Is there a way for someone not in the Apple Developer program (say an under-18 student in a class I am running) to send me a clang compiled binary that I can then run on my Mac running Catalina? iCloud seems to eat/bounce such binaries when attempting to send them via email.
Or is there a way to notarize an executable binary without a hardened runtime? How?
Not really. In some circumstances the notarisation system will accept mis-signed programs (see Notarize Your Preexisting Software) but that’s not something that new software can rely on.
Is there a hardened runtime option for clang compiles?
Not in
clang, but in
codesign. Here’s a quick checklist:
Use the 10.9 or later SDK. Notarisation requires this because it confirms that your program is using modern code signing.
Make sure you specify a deployment target using
. This causes-mmacosx-version-min
to add the relevant Mach-O load command (clang
orLC_VERSION_MIN_MACOSX
, depending on how far back you support) that’s required by the notarisation system to confirm that you’re built with the 10.9 or later SDK.LC_BUILD_VERSIONPass
to--timestamp
to get a secure timestamp.codesignPass
to-o runtime
to enable the hardened runtime.codesignIf you need to opt out of specific hardened runtime features, put the relevant entitlements in a
property list and pass that to.entitlements
via thecodesign
option. See Hardened Runtime Entitlements for more on these entitlements.--entitlementsSign your tool with your Developer ID Application identity.
If you put the tool in a
, sign that with your Developer ID Application identity..dmgIf you put the tool in a
, sign that with your Developer ID Installer identity..pkgNotarise the outermost container (for example, if you have a tool in a
on a.pkg
, notarise the.dmg
)..dmg
Share and Enjoy
—
Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware
let myEmail = "eskimo" + "1" + "@apple.com"