Install Homebrew
$ brew install bash
$ which -a bash
/usr/local/bin/bash
/bin/bash
$ /usr/local/bin/bash --version
GNU bash, version 5.0.0(1)-release (x86_64-apple-darwin18.2.0)
Copyright (C) 2019 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later
<http://gnu.org/licenses/gpl.html>
This is free software; you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
$ /bin/bash --version
GNU bash, version 3.2.57(1)-release (x86_64-apple-darwin18)
Copyright (C) 2007 Free Software Foundation, Inc.
$ sudo vim /etc/shells
add the /usr/local/bin/bash
shell to its content, so that the file looks something
like this:
/bin/bash
/bin/csh
/bin/ksh
/bin/sh
/bin/tcsh
/bin/zsh
/usr/local/bin/bash
$ sudo chsh -s /usr/local/bin/bash
$ echo $BASH_VERSION
5.0.0(1)-release