My SDL app is asking for permission to read all keystrokes from any application on macOS.

I am using SDL2.0.16 and when I run my SDL app, macOS asks for permission to allow SDL to receive keystrokes from any application. My searching shows that this should have been fixed in SDL2.0.10 so I’m not sure why I am still getting it. I am running macOS version Big Sur on a M1 MacBook Air. I really can’t ship an app that shows this popup as it will scare away users.

Thanks for your time,
Philip

Can you debug it to see what API call causes the popup to occur?

I have not yet had the chance to debug the internals of SDL2 but I did a quick test and can confirm that it comes from SDL_Init with the flag SDL_INIT_EVERYTHING.

I’m having the exact same issue, on Big Sur + M1 Mac. It could be specific to Apple Silicon macOS, because the security model is slightly different/upgraded over Intel macOS. For instance, Apple Silicon Mac apps must be codesigned to work at all, at the very least adhoc signed, but Intel apps on Apple Silicon do work unsigned.

Alright, figured out the API call that produces the request. It happens when you initialize the joystick subsystem. Attached is a source file containing examples that don’t produce the request, then a final example that does.main.c (1.9 KB)

This is false, my company makes an unsigned Mac app and it works fine on both M1 (without rosetta) and Intel.

The only “security” difference I know of is due to hardware. e.g. the M1 memory control unit wont allow memory to be executable and writable at the same time.

% echo 'int main() { return 0; }' >test.c
% clang test.c -o test
% ./test 
% echo $?
0
% codesign --remove-signature test
% ./test 
zsh: killed     ./test

Apple Silicon macOS does not allow unsigned arm64 code to run.

That has not been my experience. This is an unsigned arm64 app for the M1, compiled at the command line, and nobody has yet reported any problems running it:

http://www.rtr.myzen.co.uk/bbcbasic_console_macm1.zip

I could sign it, but so far it has not been necessary.

This has been happening for my code as well (though I only heard about it second hand, as I don’t use a Mac myself).

It seems to be tied to the initialization of the joystick/controller subsystems, which seems to be the same conclusion @nightmareci reached.

I’ve raised a GitHub issue for this (though whether it’s an issue or the expected behaviour, I’m not sure yet):