Change accessibility setting on Mac for command line program 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?
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 &amp; Privacy to give it accessibility permissions


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