10 Mar 2019
Bash 5.0 has been released during the first week of January 2019.
It builds upon Bash 4.4.x, fixes bugs, and introduces new features and improvements.
You can find extended info at the official release notes.
Although macOS is bundling Bash, it is using the older 3.x version most probably due to the Bash licensing changes. Since the Bash 4.x release, license has been changed from GPLv2 to GPLv3.
brew comes to the rescue, so installation is quite simple:
brew install bash
There are two more steps to activate Bash 5.0.
Add newly installed bash on /etc/shells:
sudo vi /etc/shells
and add a new entry/line with the path:
Make Bash 5.0 default on macOS:
chsh -s /usr/local/bin/bash
bash --version to verify that the new version is successfully activated.
Various CLI apps support improved autocomplete via bash-completion scripts.
Install bash-completion on macOS:
brew install bash-completion@2
Initialize bash-completion@2 on
~/.bash_profile with backwards compatibility:
export BASH_COMPLETION_COMPAT_DIR="/usr/local/etc/bash_completion.d" [[ -r "/usr/local/etc/profile.d/bash_completion.sh" ]] && . "/usr/local/etc/profile.d/bash_completion.sh"