I have installed the official release of SDL2 from the releases section of the repo.
Despite having followed the instructions in the README.txt and installing it into /Library/Frameworks
, I get the following error when running a basic "Hello World" application:
“SDL2.framework” can’t be opened because Apple cannot check it for malicious software.
Naturally, everything online says to just open the app using the context menu by Ctrl+clicking on it, but that doesn't work in my case. I think this is because it's not the app that can't be verified, but rather the framework.
I also tried codesign -f -s - /Library/Frameworks/SDL2.framework/Versions/A/SDL2
, but this seemed to have no effect.
How do I bypass or otherwise override this warning for the SDL2 framework?
For reference, here's the example code to test the installation:
#include <stdio.h>
#include <SDL.h>
int main()
{
if (SDL_Init(SDL_INIT_VIDEO))
{
printf("failed to initialize SDL\n");
return 1;
}
printf("Hello, SDL!\n");
SDL_Quit();
return 0;
}
I built it like so:
clang main.c -o hello -I/Library/Frameworks/SDL2.framework/Headers -F/Library/Frameworks -framework SDL2
I found the solution here. I had to open the Privacy & Security settings, then go to "developer tools" and whitelist applications that were allowed to launch "insecure" apps. I chose to whitelist the terminal and VS Code.