Notes

Upgrade to Bash 4 on macOS

Edit on GitHub

Bash Scripting
 1# install Homebrew
 2# /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
 3
 4# install Bash via Homebrew
 5brew update && brew install bash
 6
 7# Add the new shell to the list of allowed (white-listed) shells
 8# sudo bash -c 'echo /usr/local/bin/bash >> /etc/shells'
 9echo "$(brew --prefix)/bin/bash" >> /etc/shells
10
11# Change to the new shell
12chsh -s $(brew --prefix)/bin/bash 
  • sudo -i let’s you switch to root user
  • brew --prefix gives you the location of Homebrew install directory (/usr/local by default)
  • cat /etc/shells gives you the list of allowed shells