Intermittent “System Events” Permission Issue in Script Debugger on Sequoia 15.7.4

Hello everyone,

I’m currently using Sequoia 15.7.4 and running into an issue with “System Events” in Script Debugger.

According to the error message, Script Debugger — along with any scripts executed through it — sometimes doesn’t have permission to access “System Events.” The strange part is that this issue is inconsistent: sometimes everything works fine, other times it suddenly fails.

Has anyone else experienced something similar?

I’ve already tried resetting permissions in macOS System Settings, restarting the machine, and running OnyX for cleanup, but none of these steps have resolved the issue. The behavior still appears random.

Could this be related to some newer macOS security feature that gets triggered intermittently?

Are you confirming that System Events is still running? I find it falls over frequently when I’m interacting with it; causing interesting issues.

Yes, this well known but circumstances are not entirely clear.
To avoid it put

launch

as the first command in your tell System Events block.

1 Like

Thank you so much!
I’d had this problem for a few months and had posted about it on this forum, but I hadn’t found a solution.
The simple “Launch” command seems to work perfectly!
Thank you so much!

Yes, but since then I am sad to have to pour water into the wine: I recently had an issue with System Events erroring out on me at the regular 120 seconds timeout, whatever I did or tried (so did other applications depending on System Events or so at least it seemed to me). The background is that I had an overload of my USB-tree due to too many power hungry external drives, so the USB service crashed and I lost keyboard and mouse access. The only way to get out of this was a hard reboot. This, I suppose was the source of my troubles.

I googled the issue, found nothing. Then I booted into single user mode and safe mode to reset caches and stuff, I reset the power manager of my iMac (which previously had helped so solved so many completely disparate issues), deleted preferences, whatever. Nothing helped.

The only thing I could think of was to completely reinstall Sonoma over Sonoma.
Since for quite a while I had considered moving on to Sequoia, I took this as the final kick into my butt to finally do it. So I installed OS 15.7.7 (which runs very smoothly).

Now the problem is gone (of course, I tend to think) but it is not really resolved. I still don’t know what I could have tried before the last resort of OS reinstall.

In the end, I guess, it might be best to avoid System Events whereever possible and use ASObjC or shell scripts or the like. Sadly, for UI-Scripting, System Events seems to be the only tool at hand.

Yes, it was working again, and then it stopped working.
I also just upgraded to Sequoia 15.7.7, but System events still doesn’t seem to be working properly.
Very strange.
I’m still looking for the solution

Just let me confirm: you upgraded, i. e. from Sonoma or lower to Sequoia, OR updated from a previous Sequoia to the most recent version? If it is the latter:
• Make sure you have a complete, working and above all current backup of your system.
• Get the 15.7.7 FULL system installer and completely reinstall Sequoia on top of Sequoia (same version).
Let us know if this works out.
And no, this is not a “solution”. You should not be forced to do a complete OS reinstall to fix System Events. But I don’t know anything better.

Only from Sequoia 15.7.4 to 15.7.7
I don’t have the courage to take the time to reinstall the same system :wink:

One more thing to try before doing a complete OS reinstall - perhaps…

Go to System Preferences > Accessibility > System Events
Set the switch to OFF. Click on the Minus button at the bottom and remove System Events completely.
Shut the machine down.
Start up the machine holding the shift key down. When the startup completes you will find a notification in Red at the top right of the screen saying something like Secure Startup or the like.
Reboot the system.
Then try to use System Events, again.

Frankly, I would hope that this helps, but I kind of doubt it.
Have you tried to reset the power manager for your system? I did and it didn’t help. Google “reset power manager” + your machine type to find out how it is correctly done for your specific model. The methods vary vastly from one machine type to an other. You have to do it correctly to make it work.

If it all fails, reinstall the OS as above.

I guess you should try. I have done it quite a couple of times over many systems in the last decade or so and I’ve always had good experiences. To do this is officially supported by Apple (as opposed to downgrading the OS version).

One more thing to try: Create a new virgin admin account. Reboot and boot directly into this account. Try if System Events is usable. Didn’t try this myself, but it could be worthwhile to see if there is something rotten in your main user account which causes the trouble.

Yes, we should try it. Trying it on another account is a very good idea; I hadn’t thought of that.
Thanks, I’ll post an update here in a few days, once I’ve done it, if it works.