Automatically allow app (built & run by XCode) to control your computer

I am developing an assistive MacOS app in XCode / ObjC.


It intercepts keystrokes using event-taps.


When I run it from Xcode, I get:


2019-07-05 06:20:32.423783+0300 mapper[8108:1191874] unable to create event tap. must run as root or add privileges for assistive devices to this app.

2019-07-05 06:20:32.423809+0300 mapper[8108:1191874] No Event tap in place! You will need to call listen after tapEvents to get events.


I have to go to:


System Preferences

-> security & privacy

-> privacy

-> {unlock the padlock putting my admin password}

-> "Allow the apps below to control your computer"

-> {locate, uncheck and recheck my executable from the list}


Every time I modify a line of code and run again I have to go through this process of checking and unchecking.

It is a very clumsy development cycle.

Is there any way to avoid this?


https://stackoverflow.com/questions/56896203/automatically-allow-app-built-run-by-xcode-to-control-your-computer

Replies

Is your app code signed? Most problems like this are caused by the app not being code signed, so the system can’t be sure that the new build of your app is the same code as the previous build that was OK’d be the user.

Share and Enjoy

Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware

let myEmail = "eskimo" + "1" + "@apple.com"