/usr/local/bin/ not found by Automator and Java but exists in Terminal Automator Shell Script

echo $PATH
eval /usr/libexec/path_helper -s
echo $PATH


Results:

after the first echo $PATH:

/usr/bin:/bin:/usr/sbin:/sbin


after the second echo $PATH:

/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin


As ImageMagick is installed in /usr/local/bin it means that it fails unless I mess with the PATH first
anyone know where Automator (Java is the same) gets its path from and how to permanently add the missing paths
Automator uses the path variable hard coded in the kernel.

sysctl user.cs_path
user.cs_path = /usr/bin:/bin:/usr/sbin:/sbin


Actually, this is the path set for a user's launchd and is then inherited by Automator when you launch the application.

launchctl getenv PATH
/usr/bin:/bin:/usr/sbin:/sbin


Use the absolute paths to your executables or modify the PATH in the Run Shell Script.