TIL in the name of security it’s now very difficult for your app to capture keystokes on macOS. I’m working on something for fun that involves capturing keystrokes from a keyboard in python. This seems to work fine on my personal computers (which are all running Ubuntu) but when I tried to run the same thing on macOS it didn’t work.

According to the docs I should have been able to get keystrokes provided I was running as root (via sudo) but that didn’t work either. Trying to add python to the accessibility list didn’t work either as it’s not a packaged / signed macOS app.

Kinda sucks that it’s that difficult to write a simple keystroke-detecting app on macOS. I don’t want to have to write an effing electron app + using javascript to get the keystrokes instead, but I will if I can’t figure out an alternative.