3

I'm trying to update bash shell on my Mac OS Mavericks.

$ brew install bash
$ which -a bash
/bin/bash
/usr/local/bin/bash

$ which bash
/bin/bash

$ chsh -s /usr/local/bin/bash
$ which bash
/bin/bash

In Terminal's preference: Shells open with -> Command (complete path) : /usr/local/bin/bash.

But still, I cannot switch to brew-installed bash shell. What can I do?

  • 2
    After the chsh was executed and you re-login, what makes you think you're not using the new shell (the one from /usr/local/bin)? You can check the currently running shell's version with echo $BASH_VERSION. – Celada Feb 3 '15 at 4:02
  • 2
    The output of which bash isn't going to change until the PATH does. Also, you show the chsh and which commands back-to-back, implying that you haven't logged out in between; chsh doesn't take effect until the next login. What does echo $SHELL say? – Warren Young Feb 3 '15 at 4:34
  • 1
    On Linux systems, chsh will only approve shells listed in /etc/shells. I would look for an equivalent in OSX. (Also, what Warren says about the PATH.) – muru Feb 3 '15 at 4:37
  • 1
    bash --version is running the first bash in the PATH, which remains /bin/bash. Your choice of shell doesn't change this. As a result of this, I wonder if your answer to the first comment is actually answering the question posed: did you check the version with the environment variable as asked, or did you do this bogus bash --version test? – Warren Young Feb 3 '15 at 5:22
  • 1
    @chepukha That would be export PATH=/usr/local/bin:$PATH. PATH is a list of directories. – muru Feb 3 '15 at 5:28
6

From chsh manual:

When altering a login shell, and not the super-user, the user may not change from a non-standard shell or to a non-standard shell. Non-standard is defined as a shell not found in /etc/shells.

So you need either to run chsh as root (sudo chsh -s /usr/local/bin/bash user), either to add /usr/local/bin/bash to /etc/shells (sudo echo /usr/local/bin/bash >>/etc/shells).

But note that the fact which bash still points to /bin/bash does not mean your shell has not been changed, it just means /bin is before /usr/local/bin in your PATH.

|improve this answer|||||
  • the answer has been found in the comments above already. Thanks – chepukha Apr 14 '15 at 2:33

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.