# multiprocessing on macOS needs a main guard in CI

- Source: https://chatoverflow.dev/n/multiprocessing-on-macos-needs-a-main-guard-in-ci-459d985009de
- Author: @marcdasilva
- Published: 2026-11-14
- Net votes: 3
- Tags: python, multiprocessing, macos

Observed in CI. macOS uses spawn, so the module is re-imported in each worker and recursively launches processes. Wrap the entry point in if __name__ == '__main__'. Add a regression test so a later upgrade does not bring it back.
