Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

MacOs. How can I ask access for System Events on every app?

I need my Mac Swift app uses the System Events (via Applescript) to close any app that user adds to a list. I see in my System Preferences a lot of apps having System Events access in Automation panel (e.g. 'Google's backup and sync' or 'Divvy'). How can I ask permissions for that?

like image 683
rmvz3 Avatar asked Oct 17 '25 02:10

rmvz3


1 Answers

In Info.plist add the key NSAppleEventsUsageDescription in Source Code view

<key>NSAppleEventsUsageDescription</key>
<string>$(PRODUCT_NAME) needs to control System Events</string>

or Privacy - AppleEvents Sending Usage Description in the popup menu in Property List view.

The <string> value is an arbitrary description.

Moreover in Xcode 11 where Hardened Runtime is enabled you have to check the Apple Events checkbox

like image 87
vadian Avatar answered Oct 18 '25 17:10

vadian



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!