Missing SDL.h header
Author: KoPeyrNicCreated Dec 13, 2025Updated Jul 22, 2026
I tried to install Pygame on the official website on mac using brew, but it returned this message:
Using cached pygame-2.6.0.tar.gz (15.8 MB)
Installing build dependencies ... done
Getting requirements to build wheel ... done
Preparing metadata (pyproject.toml) ... done
Building wheels for collected packages: pygame
Building wheel for pygame (pyproject.toml) ... error
error: subprocess-exited-with-error
× Building wheel for pygame (pyproject.toml) did not run successfully.
│ exit code: 1
╰─> [14 lines of output]
src_c/_sdl2/sdl2.c:1094:10: fatal error: 'SDL.h' file not found
1094 | #include "SDL.h"
| ^~~~~~~
1 error generated.
Skipping Cython compilation
---
For help with compilation see:
https://www.pygame.org/wiki/MacCompile
To contribute to pygame development see:
https://www.pygame.org/contribute.html
---
error: command '/usr/bin/clang' failed with exit code 1
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
ERROR: Failed building wheel for pygame
Failed to build pygame
error: failed-wheel-build-for-install
× Failed to build installable wheels for some pyproject.toml based projects
╰─> pygameIt's the only error I got. How can I fix it?
Source: pygame/pygame