When you run Bash under shell in Emacs on macOS then update_terminal_cwd is never defined and after every command you get the error message bash: update_terminal_cwd: command not found making the shell unusable. 
 The simplest solution is to define update_terminal_cwd when it isn’t defined. 
Here is the code:
if [ -z “$(type -t update_terminal_cwd)” ] || [ “$(type -t update_terminal_cwd)” != “function” ]; then
  update_terminal_cwd() {
    true
  }
fi
