Apple - How can I debug an Automator workflow?

Enable the Automator Log

Automator's Log panel should display more detailed error information. You can show it by clicking the Log item in the View menu (or pressing ⌥⌘L).

Log Panel


If you need to debug workflow outside of Automator.app, then syslog command can be used.

Say you made Quick Action workflow with Run Shell Script action like below:

for f in "$@"
do
    syslog -s -l i "Touching file: $f"
    touch "$f"
done

"Quick Action" workflow

Now you can use Quick Action in Finder:

Running "Quick Action"

Output of syslog command can be viewed in Console.app:

Output of Syslog command

Another way to view output of syslog command – is to use log command in Terminal.app.

log stream --info --debug --predicate 'process == "syslog"'

log command in Terminal.app


Update

We can improve Quick Action shown above by sending local notification on successful completion:

for f in "$@"
do
    syslog -s -l i "Touching file: $f"
    touch "$f" || exit 1 # Early exit on failure.
    osascript -e "display notification \"Touched file: $f \" with title \"Automation\""
done

Local notification

Tags:

Automator