Script menu: how to reference user-path utilities (PATH / environment is missing)

Solution 1:

bash can startup in three different ways and how it uses rc files is different in each case.

To give a short answer when it is called as a login shell it reads .profile or .bash_profile to set things like PATH. When it is called as an interactive shell but not a login shell, say you run bash from the command line, then it reads ~/.bashrc to set these things.

If it's run from a shell script (or by launchctl) then it looks for an environment variable BASH_ENV and runs the file named in the variable.

Check https://www.gnu.org/software/bash/manual/html_node/Bash-Startup-Files.html

To answer your question you should set all variables in .bashrc, call that in your .bash_profile file with the line if [ -f ~/.bashrc ]; then source ~/.bashrc; fi Finally in .bashrc you should set the BASH_ENV variable export BASH_ENV='.bashrc'

This would then give you a PATH and so on everywhere.

When you move to the zsh shell things are slightly different, read http://zsh.sourceforge.net/Intro/intro_3.html

Most Mac admins and engineers ignore it all and we hard code the path to all our software in scripts. I've certainly never seen an Apple script that didn't have all the tool paths hard coded.