PROJ008warningPro

macos-fork-safety-missing

Shell script starts gunicorn/uvicorn/flask with reload but doesn't export OBJC_DISABLE_INITIALIZE_FORK_SAFETY — macOS devs will see 'Python quit unexpectedly' popups on every worker reload.

Applies to: Shell, ZSH

Why this matters

macOS 11+ aborts forked children that lazy-init ObjC classes before exec(). gunicorn/uvicorn --reload fork workers every time a watched .py file changes, and the forked child imports modules that transitively touch CoreFoundation (ssl, requests, psycopg2 with SSL) — tripping libobjc's performForkChildInit guard and crashing with SIGABRT. The user sees a 'Python quit unexpectedly' system popup on every edit. Setting OBJC_DISABLE_INITIALIZE_FORK_SAFETY=YES in the shell that launches the server tells the ObjC runtime to skip the guard. The env var has no effect on Linux so it's safe to export unconditionally in portable scripts.

Catch it before it ships

pip install stablestack # or: npx stablestackstablestack # scans your project, PROJ008 includedstablestack explain PROJ008

PROJ008 is part of the Pro rule set. See pricing — the free tier ships 24 checks with no signup.

False positive in your codebase? Suppress a single line with # noqa: PROJ008