Unable to run Bash 5 from launchd I have the following launchd agent:
&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;
&lt;!DOCTYPE plist PUBLIC &quot;-//Apple//DTD PLIST 1.0//EN&quot; &quot;http://www.apple.com/DTDs/PropertyList-1.0.dtd&quot;&gt;
&lt;plist version=&quot;1.0&quot;&gt;
&lt;dict&gt;
    &lt;key&gt;Label&lt;/key&gt;
    &lt;string&gt;bash-check&lt;/string&gt;
    &lt;key&gt;Program&lt;/key&gt;
    &lt;string&gt;/Users/spark/tmp/bash-check&lt;/string&gt;
    &lt;key&gt;StandardOutPath&lt;/key&gt;
    &lt;string&gt;/Users/laktak/bash-check.log&lt;/string&gt;
&lt;/dict&gt;
&lt;/plist&gt;

With the following script bash-check:
#!/usr/local/bin/bash

type bash
bash --version

I cannot get it to use Bash 5 (/usr/local/bin/bash), the log from launchctl start bash-check is always:
bash is /bin/bash
GNU bash, version 3.2.57(1)-release (x86_64-apple-darwin19)
Copyright (C) 2007 Free Software Foundation, Inc.
Your script uses type to find the first instance of bash within PATH and then calls exactly that instance. So if /bin is before /usr/local/bin (or, more likely, /usr/local/bin isn't in PATH) the macOS version of bash is found and executed.
To check the version of the running shell use
echo $BASH_VERSION

instead.