I am using pynput to record keystrokes via Listener on OS X Mojave. I am using Pycharm as my IDE for running the code.
I was not able to get it to work using the same ex
Try superuser ($sudo su) and run your python code in terminal, I think it should work
Im was working with OSX 10.12 and pynput was only getting cmd ctrl fn and option keys when pressed but now in superuser it gets the keys.