0

I'm learning bash using a Mac, and I just attempted to update bash using:

    brew install bash
    sudo -s
    echo /usr/local/bin/bash >> /etc/shells
    chsh -s /usr/local/bin/bash

Now, bash --version tells me that I have version 4.3.33, and brew upgrade bash gives me an error saying that bash 4.3.33 is already installed. However, when I try echo $BASH_VERSION, I get 3.2.57. Does this mean that I've installed version 4, but my shell is still using the earlier version? How can I make sure that I'm actually using the new version?

  • 2
    If you run echo $BASH_VERSION in a new terminal is it still saying 3.2.57? – coffeMug May 5 '16 at 16:08
  • It looks like you ran chsh as root. What does bash --version say when you open a new terminal and become root? – joepd May 5 '16 at 17:34
  • What terminal program are you using? Terminal.app and others may not necessarily use the password database shell, but could launch something else. – thrig May 5 '16 at 18:33
2

It is possible for the Terminal.app to start a specific shell for new windows instead of your login shell. Open the Terminal.app preferences panel.

On the General tab, there is an option called "Shells open with:". Normally "Default login shell" is selected, but it's possible to specify a different command.

If you have ever clicked on "Command (complete path)", the default path is "/bin/bash" which would give you the behavior you are experiencing. If this is the case, just reselect "Default login shell"

Additionally, another way to confirm that you have actually changed the shell on your user account is to run chsh (or chpass or chfn... all the same program) from your regular account without sudo, and without any command-line arguments. It will prompt for your password, then open an editor window to allow you to edit several attributes of your Unix user account at once. One of the lines of the file you are editing will list your shell. Mine says:

Shell: /bin/bash

... meaning I have not changed my default shell. If yours still says that, you can edit that line to say Shell: /usr/local/bin/bash and it will make the update.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.