0

I have built a simple command line program with Xcode, and I would like to access the NSEvent.addGlobalMonitorForEvents method. It seems like the program must be trusted for this to work.

self.monitor = NSEvent.addGlobalMonitorForEvents(matching: NSEventMask.mouseMoved, handler: { e in
    print(e)
})

How can I add a command line program to the list of trusted applications?

1 Answer 1

1

you have to export your app via Product > Archive > Export... > Export as a Mac Application, then move the app to wherever you want it (i.e., your Applications folder). Then, you'll be able to find the app in Security & Privacy to give it accessibility permissions

Credit to: vincefior In a comment on this stackoverflow question:

1
  • Not Working on Sierra! the tool is shown grayed .. May 4, 2019 at 23:01

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .