I have the following launchd agent:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">

With the following script bash-check:


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.
  • What is the output of running echo $PATH in Terminal.app? – Nimesh Neema Sep 21 '20 at 8:50
  • @NimeshNeema in what way would this influence the launchd agent? It does not use my environment. PATH includes /usr/local/bin in Terminal but not for the launchd agent. – laktak Sep 21 '20 at 9:02

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



  • You are correct, thanks! – laktak Sep 21 '20 at 9:09

You must log in to answer this question.

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