homebrew makes symbolic links in /usr/local/bin
for everything it installs, so if you want to use homebrew-provided bash
, use:
#!/usr/local/bin/bash
...
...
If you want to see the symbolic link and where it is pointing:
ls -l /usr/local/bin/bash
lrwxr-xr-x 1 mark admin 30 Mar 20 17:16 /usr/local/bin/bash -> ../Cellar/bash/4.4.19/bin/bash
If you want information about homebrew bash
, use:
brew info bash
If you want to use it as your login shell (I don't like the idea personally), you need to add it to /etc/shells
and use chsh
command.
$ echo /usr/local/bin/bash | sudo tee -a /etc/shells
$ chsh -s /usr/local/bin/bash
then open a new terminal window and verify that it works by executing
$ echo $BASH_VERSION