Mac App Launch error after Mac codesign with --options runtime

hi, team,

we used the py2app to build the mac app, the app works well before the codesign.

But when I codesign it with the --options runtime the app can't startup.

with the below error:

/petoi-mac-app/Petoi\ Desktop\ App.app/Contents/MacOS/Petoi\ Desktop\ App ; exit;
Traceback (most recent call last):
  File "/Petoi Desktop App.app/Contents/Resources/__boot__.py", line 147, in <module>
    _setup_ctypes()
  File "/petoi-mac-app/Petoi Desktop App.app/Contents/Resources/__boot__.py", line 140, in _setup_ctypes
    from ctypes.macholib import dyld
  File "<frozen importlib._bootstrap>", line 983, in _find_and_load
  File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 668, in _load_unlocked
  File "<frozen importlib._bootstrap>", line 638, in _load_backward_compatible
  File "ctypes/__init__.pyc", line 551, in <module>
  File "ctypes/__init__.pyc", line 273, in _reset_cache
MemoryError
2024-02-21 19:57:09.168 Petoi Desktop App[93968:1375266] Launch error
2024-02-21 19:57:09.168 Petoi Desktop App[93968:1375266] Launch error
See the py2app website for debugging launch issues

But if I removed the --options runtime I got the Notarizing Error below.

{
      "severity": "error",
      "code": null,
      "path": "PetoiDesktopInstaller.pkg/PetoiDesktopInstaller.pkg Contents/Payload/Applications/Petoi Desktop App.app/Contents/MacOS/Petoi Desktop App",
      "message": "The executable does not have the hardened runtime enabled.",
      "docUrl": "https://developer.apple.com/documentation/security/notarizing_macos_software_before_distribution/resolving_common_notarization_issues#3087724",
      "architecture": "x86_64"
    }

I am looking forward to your insightful reply.

Replies

The error alert you posted is being presented by your third-party tooling, not by Apple. I suggest you explore its support resources.

For context:

  • You must enable the hardened runtime in order to notarise.

  • Enabling the hardened runtime opts you in to a variety of different security checks.

  • There are entitlements that let you opt out of most of these checks.

  • Which entitlements you should apply depend on what your code is doing. Which in this case means that it depends on what your third-party tooling is doing.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"