# prerequisite: gcc
# installation steps
# download
curl https://ftp.gnu.org/gnu/bash/bash-4.2.tar.gz -o ~/Downloads/bash42.gz
tar xzf ~/Downloads/bash42.gz
# using make to compile
cd ~/Downloads/bashr42
./configure && make && sudo make install
# using new shell
chsh -s /usr/local/bin/bash {user_name}
sudo bash -c "echo /usr/local/bin/bash >> /private/etc/shells"
# replace the old shell with the new one
sudo mv /bin/bash /bin/bash3.2.58
sudo ln -s /usr/local/bin/bash /bin/bash