0

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?

6
  • 1
    Why did you change root's shell? Aug 30, 2022 at 15:29
  • Why not? I want all my shell to be Bash so I can source my .bash_profile where all my configurations are
    – Leonardo
    Aug 31, 2022 at 13:34
  • Then the question devolves to "why are you logging in as root?" Aug 31, 2022 at 14:21
  • I'm not, sometimes I open another shell as sudo but being the child of the current shell it is supposed to be bash already. So I guess there is no real reason to change the default shell root
    – Leonardo
    Aug 31, 2022 at 14:45
  • What problems might cause changing the default root shell? In my case I was changing /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
    – Leonardo
    Aug 31, 2022 at 14:50

1 Answer 1

1

It turns out in iTerm I had two profiles with the same name (not sure how it is possible), one was the default profile while the other was not.
Deleting one of these and setting the other as the default one fixed my problem.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .