Automator Shell Script Problem

I use Pandoc to convert Markdown files to PDFs. If I call Pandoc from the Terminal directly, to works fine. To automate the process, if in Automator I use the "Run Shell Script" command, I get the error shown in the screenshot.


If I use an AppleScript to run a Shell Script, it works fine, but it leaves a Terminal window open once it's completed.


How do I get Automator to run the Shell Script properly?


(If it matters, zsh shell throughout).


Posted on Jan 31, 2023 08:46 AM

Reply
4 replies

Feb 1, 2023 06:44 AM in response to tom.mclean

The Automator Run Shell Script has no knowledge of your PATH as you have it set in your SHELL dotfile. It won't know that pandoc is either in /usr/local/bin, or /opt/homebrew/bin if you simply reference pandoc by its name. Your options:


At the beginning of the Run Shell Script apply one of these appropriate for the Shell in use, where the dotfile is exporting a PATH statement that includes one of the paths above:


source ~/.zshrc
source ~/.bashrc
source ~/.bash_profile


Or, in the absence of the source statement, explicitly reference pandoc where it resides. Either of:


/usr/local/bin/pandoc
/opt/homebrew/bin/pandoc


Since you haven't shown the Run Shell Script source inclusive of the pandoc invocation, any inadvertent syntax error preceding or trailing the pandoc reference remains a mystery until you post the code here using the <> code tool in the toolbar.




This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

Automator Shell Script Problem

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.