Applescript fails with error (-600) when launched over ssh on Mavericks

applescript executeandreturnerror
applescript not working
does applescript still work
swift run applescript
xcode run applescript
xcode applescript
the action run shell script encountered an error operation not permitted
add system events to accessibility

I've tried searching for this, and have seen others with similar problems but don't seem to have found an answer anywhere....

I have an AppleScript that I am trying to run over ssh so that I can remotely control my mac. This has worked previously with OSX 10.8 but no longer seems to work since upgrading to 10.9.

The command I am executing is:

ssh <user>@mymac.local "osascript -e 'tell application \"iTunes\" to play'"
  • I have already set up RSA keys so the ssh session opens correctly
  • I am connecting as the same user that the Mac is currently logged in and running under
  • iTunes is running on the Mac with that user at the time the script is launched

The script fails, coming back with:

execution error: iTunes got an error: Application isn’t running. (-600)

Similarly, a number of other scripts that I had previously been using also seem to now be broken on 10.9 with the same error, so this seems to be related to the fact that it's running over ssh, rather than an issue with iTunes or a specific application.

I've tried packaging the applescripts as applications, saving them on the remote Mac, and then opening them from within an ssh session, but this also fails:

ssh <user>@mymac.local
open "~/Desktop/Play Music.app"

(Where 'Play Music.app') is an applescript exported as an app).

This does not report an error within the ssh session, but an applescript dialog appears on the remote mac:

I also have several scripts that were scheduled with crontab on my Mac, and these are also failing since upgrading.

I assume this is some sort of security change as part of Mavericks, but I can't seem to find a way to make it work again. Does anyone have any solutions to this?

Application isn’t running(-600) is an operating system error.

An operating system error is an error that occurs when AppleScript or an application requests services from the Mac OS. They are rare, and often there is nothing you can do about them in a script, other than report them.

macos, Application isn't running(-600) is an operating system error. An operating system error is an error that occurs when AppleScript or an application requests  I have a script to temporarily mount an SMB share and copy some files that get generated for my team. It works find locally, but fails to mount the remote share when run from cron.

Arrrrgh! I don't want this to be the answer, but after trying just about everything, this now seems to be working after a restart.... My guess is that something in appleeventsd got confused (although restarting just appleeventsd on its own didn't fix anything). After a restart osascript seems to be behaving again. I'm still not convinced this is fully fixed, but it does seem to be working for the moment...

Applescript fails with error (-600) when launched over ssh , Applescript fails with error (-600) when launched over ssh on Mavericks. Question. I've tried searching for this, and have seen others with similar problems but  How to keep remote processes from ending when disconnected [closed] osx,ssh,raspberry-pi,osx-mavericks. You can use tmux or screen! the above are software applications that can be used to multiplex several virtual consoles, allowing a user to access multiple separate terminal sessions inside a single terminal.

For me, it was Apple Entitlements in Xcode.

Specifically,

com.apple.security.temporary-exception.apple-events

Set it as an Array

Then add two items to it.

com.apple.finder

com.apple.iTunes

See: My applescript doesn't work any more when I upgrade my OS X to 10.9

Indigo Domotics • View topic, I have an AppleScript that I am trying to run over ssh so that I can remotely control my mac. I assume this is some sort of security change as part of Mavericks, but I can't seem to Application isn't running(-600) is an operating system error. I'm still seeing this issue, using version 0.2.1 from brew. Running xctool works fine when logged in as the user through terminal, but when commands are sent over ssh with the user still logged in, it fails to launch the simulator correctly.

Apple Script is not the issue.

Enable access for assistive devices and applications by opening System Preferences > Security & Privacy > Privacy > Accessibility and check the applications you want to allow access.

More info: https://support.apple.com/en-us/HT202866

Jacob Salmela also has created a utility to do this from command line:

http://jacobsalmela.com/os-x-yosemite-enable-access-assistive-devices-command-line/

Many workflows stopped working after updating both OSX and , For instance, 3 stop/start cycles of the server failed to get it working but after a 4th in Mavericks) where the OS gets confused when trying to target some error: IndigoServer got an error: Application isn't running. (-600). rsync > Copying large files over a network or between filesystems. There are times were extremely large files need to be copied across filesystems and if the rsync command does not complete or fails for whatever reason it's useful to how to resume a failed rsync operation. To start a rsync operation that can be resumed

for me this happened when I tried to open gitk. Changing back to the branch I was on before, and gitk was able to open again

Use ssh to run ios-sim will cause segmentation fault:10 · Issue #112 , But they're important part of my work flow and I hope to get them back ! 1: 0:90: execution error: System Events got an error: Application isn't running. (-600). For my own terminal popping workflow: [ERROR: alfred.workflow.action.applescript] -fails-with-error-600-when-launched-over-ssh-on-mavericks. I hope this is the right place for this, if not, suggestions are welcome I'm trying to figure out the best way to synchronise the launching of an app session file whenever another app is launched.

Run an AppleScript from the command line, Hello, We are using Jenkins to run CI tests, which will use ssh to run ios-sim. on Mavericks using XCode 6, but only when I start the ios-sim from a ssh shell you can call ios-sim from Apple Script over ssh like this: osascript -e 'tell got an error: Application isn't running. (-600). This case doesn't happen  It runs file sharing over the SSH protocol. This comes with interesting possibilities, especially when a server or NAS is already running SSH (Secure Shell, kinda like a remote DOS prompt), since there is no need to install another network sharing protocol. The latter being great when you have no say in what is being installed on said server.

Doug's AppleScripts AppleScript Archives » Doug's AppleScripts, Want to run an AppleScript command real quick from Terminal? Anyway, is there any way to get osascript to work when logged in (ssh) remotely? Finder to quit I get the error "Finder got an error: Application isn't running. (-600)", however it clearly is running. Only the osascript/applescript section fails. Q&A for power users of Apple hardware and software. Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

For example, a script that targets composer of a TV track will fail. Stuff like that makes it difficult to write one script that can work in both Music and causing the Invalid parameter error people are seeing with launching scripts. can store the dimensions of a track's artwork (eg, "600x600") to the Category or Episode ID tag. How to use Terminal, launched from OSX setup screen, to create new user? osx , terminal , osx-yosemite , createuser I'm not sure how you prepared the USB drive, but it looks like it doesn't include dscl.

Comments
  • Yep - As I said in the post, iTunes is open at the time. I'm assuming that it has something to do with the ssh shell not being able to see the process, even though it is running with the same user account...
  • are you able to get a simple dialog to appear ?
  • also what happens if you run the script the same command in the terminal locally on the machine
  • I can display an alert over ssh. So this works: osascript -e "tell application \"System Events\" to display alert \"Hello\"" The alert appears on the remote screen
  • If I run the script from the terminal locally on the machine it also works fine. It seems to be running it through an ssh session that's the problem
  • Oh there is a thing one can do: restart the machine :)
  • Rebooting cleared this for me. Very frustrating, but nice that this page exists so we know to try this. Thanks!
  • When I have this error, I am sure I can see "System Events" in Activity monitor. Wait for some minutes, and the error disappears.
  • I am trying to develop and debug a script and if I have to keep rebooting every few minutes because the system hoses itself I am going to be VERY cross...
  • Agreed, which is why this isn't really an 'answer'... I'll keep an eye on it and see if it breaks again, then maybe I can work out what breaks it and hopefully we'll be closer to fixing it.
  • I would like a proper answer as well - but this did solve my problem and so I'm upvoting. :)
  • This just happened to me when trying to debug a spontaneous failure of the Dropbox app over ssh. Can't figure out how to fix it...
  • Oh, this is another very upsetting thing from Apple :( First time I got this in the beginning of 2019 (mid-January) on High Sierra 10.13.1 (upgraded much earlier and definitely have not had any issues for many months). By the way this is a VM on VMware Fusion and suddenly I found it [VM] to be down. I turned it back on and immediately started having this issue. After visiting this page I restarted VM and it cleared it for a while, but today I have faced it again. Then it cleared after a few hours without a restart. Currently looking on how to diagnose this better, since this getting annoying..
  • This was absolutely the case for getting Sublime Text to cooperate with Applescript. Glad I scrolled down to your answer.
  • Just a follow-up. This piece of code seems to make applescripts run more reliably locally, but I still can't get osascript to run over SSH. osascript can't interact with any active applications and it's god damn infuriating.