2

This question already has an answer here:

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

marked as duplicate by user151019, Community Apr 6 '16 at 11:25

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • Seperate Lines echo $PATH >> eval /usr/libexec/path_helper -s >> echo $PATH – Jeff Vallis Apr 4 '16 at 12:55
  • Results >> first echo = /usr/bin:/bin:/usr/sbin:/sbin second echo = /usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin – Jeff Vallis Apr 4 '16 at 12:58
  • I edited your question. Please check my mods – klanomath Apr 4 '16 at 13:01
  • The answers for Automator and Java will differ as the first is launched through the GUI and the second most cases will be via command line - there are many duplicates of both on this site – user151019 Apr 4 '16 at 13:29
2

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.

  • Very interesting! +1 A simple echo $PATH in a Run Shell Script confirms this and I have had issues in the past and never checked this! Now I know why I have had to hard code some paths! :) – user3439894 Apr 4 '16 at 15:28
  • You can also add a PATH= ... statement, set to what's in the environment, to the top of the Run Shell Script and then not have to hard code the path to the executable. You can add that to your answer if you want. – user3439894 Apr 4 '16 at 15:39

Not the answer you're looking for? Browse other questions tagged .