1 minute read

Depending how you installed a new version of bash on your mac, it might surprise you to learn which version of bash you’re using. For instance, if ask for the version of bash at the prompt. Here’s a reasonable example.

$ bash --version 
GNU bash, version 5.2.15(1)-release (aarch64-apple-darwin21.6.0)

Looks good. If, however, we then go and check the BASH_VERSION …

$ echo $BASH_VERSION
3.2.57(1)-release

We get a very different and worse number. What gives? Well, your login shell is using a different version of bash than is currently front on your path.

This SO thread helpfully describes the problem and the issue. If you are using the new version of homebrew, then you might have had to move where you keep the programs brew installs: the new location is /opt/homebrew/bin. If that’s the one you want to set as your login shell, then you’ll have to first add it to the /etc/shells file, and then use the following to set it.

chsh -s /opt/homebrew/bin/bash
sudo chsh -s /opt/homebrew/bin/bash

(If you failed to add that to your /etc/shells file, then chsh will squawk that this is a non-standard shell.)

But after this, you should be good to go with an up-to-date login shell.

Updated: