OSX Bash Upgrade | Alt255 Blog

December 30, 2017

OSX Bash Upgrade

Notes on getting bash completion to work on OSX and upgrade bash along the way.

Using brew, install bash-completion:

$ brew install bash-completion

Update .bashrc to include:

if [ -f /usr/local/etc/bash_completion ] && . /usr/local/etc/bash_completion

If you receive errors like this: bash: compopt: command not found, your version of bash is likely outdated. Check the version using bash --version. compopt apparently requires version 4.0 or above.

To upgrade bash using brew:

$ brew update && brew install bash
# Add new shell to list of allowed shells, then drop sudo permissions:
$ sudo bash -c 'echo /usr/local/bin/bash >> /etc/shells' && sudo -k
# Change over to the new shell:
$ chsh -s /usr/local/bin/bash

Open up a new terminal and test the version of bash:

$ echo $BASH_VERSION
4.4.12(1)-release

References