macOS deployment requires administrator rights
andreped opened this issue · 5 comments
Quite annoyingly, the keyboard
library requires sudo
rights in order to be used on macOS.
If this is not done, you will get this error message.
The alternatively is to run the script like so: sudo python deploy.py
Even still, now with sudo the program might fail to find the dependencies (observed on macOS).
Nonetheless, this is bad practice. We should not need sudo permissions to deploy the software. We need to find a way to enable keyboard events on macOS (all UNIX-based systems likely have the same issue, e.g., Ubuntu).
Could try replacing it with pynput
(see here). However, I feel I have tried this before and it did not work.
Using pynput
runs into zsh: illegal hardware instruction
and crashes the program when attempting to listen for keyboard events. Might be that it also requires sudo rights?
According to the documentations, pynput
does also require sudo permissions to run (see here). However, on macOS, if you bundle the program as a python package you can whitelist the program when running it.
This is a valid alternative, however, it would be much better to avoid it altogether.
After removing the keyboard listeners and events, I got a new error which is solely fixed in 909e264.
After that, I reach the same issue as for Windows. Hence, keyboard events definitely require handling.
An idea I had was to build a very simple GUI for the software and save it as an application. That way in the macOS security settings one could whitelist the program to allow keyboard events.