I need to run some WolframScripts on a schedule so I am trying to set up MacOS Automator to run them but I am having issues. Any help would be greatly appreciated.
Here is what I have so far:
sendGmail["firstname.lastname@example.org", "test subject", "test body"];
This script works (after making it executable of course).
Since I could not figure out how to kick this script off with Automator, I created a shell script which I can kick off with Automator:
wolframscript -file send-test-email.wls
This works as well from a terminal.
But, when I try to "Run Shell Script" from Automator, I get an error:
I spent an hour searching the web and learned:
Have a great week.
Figured this out... but it took a bit more caffeine. It would seem that Automator does not search the path. We can argue the wisdom of this. I can see both sides of the argument.
Nonetheless, it would be great if the documentation (on Apple's end this time) was a bit clearer.
So, in the end, this works:
A guess. Automator does not create an interactive shell so .zshrc is not sourced, so wolframscript is not in the PATH. Try adding source ~/.zshrc to the Automator script before executing the shell script.
Thank you for your suggestion. You are, of course, correct. But, there is a but. Automator does not keep the path setting from the .zsh (or .zshrc). From what I can tell, I'm not the only one who has run into this.
Following your lead, I can put the following at the top of the "Run Shell Script":