This post is an introduction to the library SDL3, that is the 3rd major version of the Simple DirectMedia Library (SDL).
You can read a post that is an introduction to SDL and the different SDL versions on this post.
The first SDL3 public version (3.1.3) was released on 4 October 2024.
Installing SDL3
The installing instractions corresponds to the latest version as of 2025: SDL3.
Installing SDL3 in macOS X
Download the .dmg file with the latest version from the official SDL site.
Alternatively, download the source code and compile it directly. You can read a video about how to do it on this external link.
In both cases you will get a folder that is referred as “source folder” in this post.
Find the folder “SDL3.xcframework” within the source folder. Go into the “macos-…” folder.
Go to the folder /Library/Frameworks. You can use the shortcut Command + Shift + G to achieve this.
Copy the folder “SDL3.framework” from the .dmg into /Library/Frameworks/. The system will prompt the password.
Go to the /Library/Frameworks/SDL3.framework folder and run the “SDL3” program.
In case you got an error informing that the developer is unknown you need to go to Apple icon > System Preferences… >> “Security” and click on the “Open anyway” button next to the warning message. Run the “SDL3” program again.
The system will display a terminal explaining that process is completed.
Running a program with SDL
You need to link the SDL libraries in compilation time.
Running a program with SDL from command line
For example, if you are running it from macOS X, use clang as a compiler and will call the library from a C++ program you may run:
clang main.c -F/Library/Frameworks -framework sdl3 -o prog
For example, if you are running it from macOS X, use clang as a compiler and will call the library from a C++ program you may run:
clang++ main.cpp -o prog -F/Library/Frameworks -framework sdl3
Running a program with SDL from Visual Studio Code GUI in macOS X
Run the program before it gets an error because it does not find the “SDL3” libraries. Select the “clang” compiler. A tasks.json file will be created in folder “.vscode”.
Open the tasks.json file and add the following lines to the args command:
"-F/Library/Frameworks",
"-framework", "SDL3",
Click on “Run” button again.
This solution will compile, but IntelliSense will still detect errors in the visual editor.
Click to the Command Palette (Cmd + Shift + P).
Type : “C/C++ Configurations (UI)”.
Add the following line to the include path (in case there is something written there, just add an extra line):
/Library/Frameworks/SDL3.framework/Headers
Go to Advance Settings and add the following line to Mac Framework Path:
/Library/Frameworks
Learning SDL3
Learning SDL3:
- SDL specification
- SDL tutorials
- SDL examples
SDL Specification
SDL3 official API specification
SDL Tutorials
SDL Examples
You can find SDL3 examples on this external link.
You might also be interested in…
External References
- Installing SDL3 in macOS X
- Mike Shah; “Installation“; YouTube