Excluding the Mac, all code on all Apple platforms must be signed with an Apple-issue signing identity. The Mac-specific exceptions [1] are:
If you work with Xcode then it defaults to ad hoc signing. If you build from the command-line tools you’ll see two defaults:
This second point is achieved via linker signing, that is, the linker will add an ad hoc code signature to the Mach-O image that it creates [2]. You can override this default (enable it for Intel code or disable for Apple silicon) via the -adhoc_codesign and -no_adhoc_codesign options. See the ld man page for details.
The upshot of this is that most folks who build code to run locally on their Mac don’t need to worry about code signing:
-
If they’re using Xcode, it should default to Sign to Run Locally.
-
If they’re using command-line tools, the linker should do the required ad hoc signing.
If you’re having problems with the former, check that you have Sign to Run Locally selected in the Signing & Capabilities editor.
Share and Enjoy
—
Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"
[1] There are more exceptions if you disable SIP, but I’m not going there.
[2] Assume it can carry a code signature. Certainly linker products, most notably MH_OBJECT files, can’t.