Encounter "zsh: trace trap" after updating trust settings for Apple certificates

Hi guys,

New to publishing apps on Apple Store. I encounter some notarization error before and resolved it in this post.

By solving the previous issue, I updated the Trust setting from "Always Trust" to "Use System Defaults" for Apple certificates. The codesign and notarization no longer give me any problem. But now, I encountered another issue. When I ran the .app on my local Macbook, it now gives me "zsh: trace trap" error. Dive a little further and check the crash report, I found the some details as following.

Process:               my_app [30652]
Path:                  /Users/USER/my_app_path
Identifier:            my_app
Version:               0.0.0 (???)
Code Type:             ARM-64 (Native)
Parent Process:        launchd [1]
User ID:               501

Date/Time:             2025-07-15 14:57:58.9874 -0400
OS Version:            macOS 15.5 (24F74)
Report Version:        12
Anonymous UUID:        2335F0B6-A26E-6446-6074-0FCE620C4B6A


Time Awake Since Boot: 6000 seconds

System Integrity Protection: enabled

Crashed Thread:        0  Dispatch queue: com.apple.main-thread

Exception Type:        EXC_BAD_ACCESS (SIGKILL (Code Signature Invalid))
Exception Codes:       UNKNOWN_0x32 at 0x00000001064b4000
Exception Codes:       0x0000000000000032, 0x00000001064b4000

Termination Reason:    Namespace CODESIGNING, Code 2 Invalid Page

VM Region Info: 0x1064b4000 is in 0x1064b4000-0x1064b8000;  bytes after start: 0  bytes before end: 16383
      REGION TYPE                    START - END         [ VSIZE] PRT/MAX SHRMOD  REGION DETAIL
      mapped file                 1064ac000-1064b4000    [   32K] r-x/rwx SM=COW  Object_id=d2a02fbf
--->  VM_ALLOCATE                 1064b4000-1064b8000    [   16K] r-x/rwx SM=PRV  
      __TEXT                      1064b8000-1068a4000    [ 4016K] r-x/rwx SM=COW  my_app.app/Contents/Frameworks/Python.framework/Versions/3.12/Python

I can tell it's about codesign and signature invalid. I have tried to rebuild, re-codesign and re-notarize. But the error still persists. Could someone help me? Thanks!

Answered by DTS Engineer in 849461022

Thanks for the crash report.

This clearly indicates that your app was up and running when it crashed. The backtrace of the crashing thread looks like this:

Thread 0 Crashed::  Dispatch queue: com.apple.main-thread
0 libsystem_platform.dylib      … sys_icache_invalidate + 40
1 libllvmlite.dylib             … llvm::sys::Memory::protectMappedMemory(llvm::sys::MemoryBlock const&, unsigned int) + 356
2 libllvmlite.dylib             … LLVMPY_TryAllocateExecutableMemory + 92
3 libffi.dylib                  … ffi_call_SYSV + 80
4 libffi.dylib                  … ffi_call_int + 1220
5 _ctypes.cpython-312-darwin.so … _ctypes_callproc + 1384
6 _ctypes.cpython-312-darwin.so … PyCFuncPtr_call + 212
7 Python                        … _PyObject_Call + 164

That suggests you’re hitting a hardened runtime incompatibility. See Resolving Hardened Runtime Incompatibilities.

Share and Enjoy

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

The only ‘obvious’ thing I can think of here is that you’re trying to run App Store distribution-signed locally. That doesn’t work in general. See Don’t Run App Store Distribution-Signed Code.

If this is Developer ID signed code then that doesn’t apply, and there’s something else in play. You posted a crash report snippet. Is that the full crash report? Or is there more? If so, please post the full report as a text attachment. See Posting a Crash Report for detailed advice.

Share and Enjoy

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

Hi DTS,

Thanks! I have been using "Developer ID Application" certificate to sign the code. I did not post the whole crash report before. Please check the attachment, which does contain the full crash report this time. Thanks!

Thanks for the crash report.

This clearly indicates that your app was up and running when it crashed. The backtrace of the crashing thread looks like this:

Thread 0 Crashed::  Dispatch queue: com.apple.main-thread
0 libsystem_platform.dylib      … sys_icache_invalidate + 40
1 libllvmlite.dylib             … llvm::sys::Memory::protectMappedMemory(llvm::sys::MemoryBlock const&, unsigned int) + 356
2 libllvmlite.dylib             … LLVMPY_TryAllocateExecutableMemory + 92
3 libffi.dylib                  … ffi_call_SYSV + 80
4 libffi.dylib                  … ffi_call_int + 1220
5 _ctypes.cpython-312-darwin.so … _ctypes_callproc + 1384
6 _ctypes.cpython-312-darwin.so … PyCFuncPtr_call + 212
7 Python                        … _PyObject_Call + 164

That suggests you’re hitting a hardened runtime incompatibility. See Resolving Hardened Runtime Incompatibilities.

Share and Enjoy

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

Hi Quinn,

Thanks for the information! I tried the link you mentioned, but no luck so far. I tried the following so far:

  1. Add "com.apple.security.cs.allow-unsigned-executable-memory" to the entitlements.plist file.
  2. Normalise the Entitlements Property List
  3. Re-codesign the .app folder.
  4. Notarize and staple the .app folder

I tried syspolicy_check distribution my_app.app and got the following App passed all pre-distribution checks and is ready for distribution.

But when I try to run the app from the terminal, I still got zsh: trace trap ./path_to_my_app error. When I tried to launch the app by double clicking the .app file, it would exist immediately without launching it.

Encounter "zsh: trace trap" after updating trust settings for Apple certificates
 
 
Q