I face a vexing problem on my home set-up involving a Server mac advising a Client mac that a task (a back-up task) was successfully implemented. The purpose of this instruction is to trigger (through the Client mac automation software) the shut down of the backup disk power supply, to save energy. Both macs are running high Sierra and the Client mac must run the following applescript upon receipt of the appropriate instruction from Server (xtension.app is a home automation software having applescript interface but no shell script interface).

sPowerDownD2.scpt ("apple_script")

Tell application "xTension"
execute script "TurnOffD2"
end Tell

The above applescript, located in any directory of the Client mac, works when addressed manually and locally: I can trigger it (1) locally on the Client mac by hand on the applescript or (2) it works by a local manual command to a shell script located in a directory of the same Client mac the job of which being to trigger the applescript or (3) by the below line of command in terminal ("shellScript") .

osascript /path_to_apple_script/apple_script

To trigger the applescript from the Server mac (away from the Client mac), I have first tested a ssh shell script having root privileges on both machines

ssh -i /var/root/.ssh/jxxxxxx_rsa [email protected]

This script works when requested to execute simple tasks on the Client mac (like listing files seen in a directory), but fails when used to trigger the applescript above, directly using osascript or indirectly.

Example: any attempt to indirectly trigger the applescript through a shell script command fails.

ssh -i /var/root/.ssh/jxxxxxx_rsa [email protected] /path_to_shellScript/shellScript

ERROR MESSAGE ON FAILURE It fails with the error code : "execution error: An error of type -10829 has occurred. (-10829)

Second example: any attempt to directly trigger the applescript also fails.

ssh -i /var/root/.ssh/jxxxxxx_rsa [email protected] osascript /path_to_apple_script/apple_script


I have verified permissions on files and directories (tried different combinations as well)

I also have tried to correct possible privilege issues and, to do that, tried to use the recommended shell commmand

password "pswd" with administrator privileges

Whatever I do, the best I can get is the -10829 error message..

What could I do wrong ?

Thanks in advance for any suggestion or doubt.

  • What is the h command used in the first examples? Also it's not very easy to follow what you are trying to do, what does work and what does not (nor how it fails). Can you revise the question to put some more structure in (and remove things like the email workaround which primarily distracts from the main problem)?
    – nohillside
    Jan 10, 2022 at 18:50
  • 1
    I don't fully understand what you're doing, but it sounds like you may be running into the TCC ("Transparency, Consent and Control") security layer (see this question), which (among other things) restricts controlling apps via AppleScript. This Superuser question might be relevant... Jan 10, 2022 at 19:45
  • nohillside and Gordon, many thanks for your comments. I have tried to clarify the issue above. and, Gordon, it is quite possible that my issue relates to non-permissible actions otherwise made possible through Applescript. Both computers, however are too old to fall under the restrictions imposed by mojave, being high Sierra compatible only.. Jan 11, 2022 at 12:19

1 Answer 1


Graphical User Session

The AppleScript is not being run within the active graphical user session and thus can not access the WindowServer. This is required for Open Scripting Architecture (OSA) languages to interact with graphical applications.

If you can perform your script without needing to interact with a graphical application, an ssh initiated approach can work.

Otherwise, consider a third party tool, such as Power Manager, which can run scripts as the active user. I am an engineer behind Power Manager, so feel free to get in touch and ask any technical questions about how it works.

  • Thanks Graham. The applescript solely addresses scriptable portions of a scriptable app (xtension), I do not believe it therefore qualifies as being subject to the restriction you first mention. Further, on the same, High Sierra does not seem to implement, yet, this apple Mojave guideline. Thank you for your support. Jan 11, 2022 at 12:40
  • 1
    If the app is a GUI app then yes it does
    – mmmmmm
    Jan 11, 2022 at 12:44
  • AppleScript is fundamentally a graphical application scripting language. Apple's implementation assumes access to the WindowServer and graphical user session. This includes applications and extensions that provide an OSA scriptable interface. Jan 11, 2022 at 13:11
  • Thank you all. Even when using High Sierra, I give up on the approach and will seek other alternatives. Among suggestions that what I want to do is solely permissible with shell scripts, I also found the two references below from early 2020. « Catalina’s Privacy protection backfires again (3 jan 2020) » <eclecticlight.co/2020/01/03/…> Followed by « Why privileges commands may never be allowed ( 15 Feb 2020) » <eclecticlight.co/2020/02/15/…> Jan 15, 2022 at 8:36
  • Please can you accept the question as answered. Jan 15, 2022 at 12:00

You must log in to answer this question.

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