Skip to content

Mac OS 10.14.4 restricts CGEventTapCreate #2

@kdemarest

Description

@kdemarest

I really, really want this beautiful fix you made, but when compile and run it in 10.14.4 it always returns with "Failed to create event tap"

I have visited System Prefs / Security & Privacy / Accessibility and added the compiled executable into the control list. Also, each time I recompiled I re-added the app, because the signature might change. Just to be sure.

Also, I have been running the executable as sudo, to make sure it had maximum privileges. Doesn't seem to help. A post seems to say that an Info.plist file is required, but I'm just not a Mac programmer so I don't know how to add one to a pure C program to try to make a fix. Here is the post: https://forums.developer.apple.com/thread/109283

Here is the failing code. I have tried changing the eventMask to be just the scroll wheel, but that didn't help.

eventTap = CGEventTapCreate(kCGHIDEventTap, kCGHeadInsertEventTap, 0, eventMask, myCGEventCallback, NULL);

if (!eventTap) {
    fprintf(stderr, "Failed to create event tap\n");
    exit(1);
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions