On MacOS Monterey I've installed bash 5 with brew, installed in /opt/homebrew/bin/brew
.
Now I want to make this the default login shell, so I did
- add
/opt/homebrew/bin/bash
to/etc/shells
. chsh -s /opt/homebrew/bin/bash
sudo chsh -s /opt/homebrew/bin/bash
Then in iTerm I checked "login shell" as the default command to launch. Then restart my machine.
No matter what, when I open iTerm and echo $BASH_VERSION
the result is always 3.2.57(1)-release
that is the old default bash version shipped with MacOs, not my brew installed bash 5.
No idea what can cause this
If I launch the default Terminal.app instead of iTerm and I echo $BASH_VERSION
then I get the good brew 5.1.16(1)-release
version.
So I guess at this point it's a problem of iTerm, even tough I've double checked and the default command is "Login Shell"
The first time I launch iTerm then $BASH_VERSION
is always the wrong one (old version) but when I create secondary new tab then the $BASH_VERSION
is the correct one!
I’m confused where to look next. Does anyone know how to make iTerm work like terminal.app in this case?
/bin/bash
->/opt/homebrew/bin/bash
. It is bash in both cases and it will source my .bash_profile in both cases, it's just a matter of upgrading the bash version from 3 to 5