6

Greeting!

I followed the answers in here and got the latest version (5.2.15) of bash installed on my Mac. But when I ran bash --version it still shows:

GNU bash, version 3.2.57(1)-release (arm64-apple-darwin22)

I check the /etc/shells and the newly installed bash path is in the list:

...
/bin/zsh
/opt/homebrew/Cellar/bash/5.2.15/bin/bash

When I tried running dscl . -read ~/ UserShell it shows the newly installed bash.

UserShell: /opt/homebrew/Cellar/bash/5.2.15/bin/bash

I already restarted the Terminal and my mac but to no avail.

I also tried changing the Shells open with: in Terminal settings to Default login shell and Command (complete path) but both still show the 3.2.57 version

Also I already found this but I don't the tmux installed on my Mac.

Any idea about this? I need to run a .sh file and it require bash 4 or above

UPDATE:

Running which bash shows /bin/bash

0

1 Answer 1

6

Most likely you switched shells successfully, but use the wrong command to check the version. bash --version will start a new bash from PATH, in your case this is /bin/bash. Use echo $BASH_VERSION instead to check the version.

Nevertheless, it's a bad idea to use a path pointing to the Homebrew Cellar, it will break as soon as Bash gets updated to 5.2.16. Most binaries installed via Homebrew are linked to from $(brew --prefix)/bin (/opt/homebrew/bin for M1/M2), so to fix this

  • edit /etc/shells (sudo nano /etc/shells), replace /opt/homebrew/Cellar/bash/5.2.15/bin/bash with /opt/homebrew/bin/bash
  • run chsh -s /opt/homebrew/bin/bash
  • open Terminal settings and set "Shells open with" to "Default login shell"

Then restart Terminal.

0

You must log in to answer this question.

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