When I try to run a script that contains the envsubst command, I get this error. Looking online, this seems to be a standard bash command, so I am not sure what to install in order to get it to work.
brew install gettext
brew link --force gettext
This will enable envsubst on OS X, and force it to link properly. It requires homebrew to be installed.