broken on Mojave
Fails with:
Initializing event mask for 'mouse' events ERROR: failed to create event tap
This is due to changes in Mojave requiring the 'app' to be added to the whitelisted apps in 'Security and Privacy'.
However it seems you need to add a key to the app plist to do this:
https://forums.developer.apple.com/thread/109283
My attempts to make this work here failed. I'm not even sure you can have a info.plist for a non-bundle binary.
However it seems you need to add a key to the app plist to do this
<key>NSAppleEventsUsageDescription</key>
<string></string>
Note that even with the above key in the app .plist file, you will still need to whitelist the app in Security & Privacy. Starting with 10.14, I am not aware of a way to get around this.