42

since Mountain Lion still uses the old bash 3.x, I was wondering if there is a good tutorial (or if somebody could post one here) on how to upgrade bash to the latest version. Also, it would be helpful to know how to set the path so that it can be used in terminal.

Thanks in advance

3

1 Answer 1

54
  • Update brew: brew update
  • Install bash with brew install bash
  • Add /usr/local/bin/bash to /etc/shells
  • Change the default shell with chsh -s /usr/local/bin/bash

You don't normally have to change any settings in Terminal or iTerm 2. Both of them default to opening new shells with the default login shell.

5
  • would you recommend upgrading bash. I read in your linked article that there is a chance that you can lock yourself out.
    – Tom
    May 7, 2013 at 16:51
  • @Tom I edited the answer, but if you get locked out, you can change the default shell from System Preferences or just change the login command in Terminal or iTerm.
    – Lri
    May 7, 2013 at 17:18
  • @kristi I renamed /usr/local/bin/bash as /usr/local/bin/bash4 because I want to keep bash 3.2 as my default for the moment. Rationale: as a sys engineer, I need some kind of reminder that some things that are easily and routinely done in bash4 need a workaround in bash 3. Grrr!!! Mar 11, 2014 at 0:15
  • 2
    @kristi - in other words, I executed step 1 of your instruction set and stayed away from steps 2 and 3 of your instruction set. Mar 11, 2014 at 0:28
  • Thanks, it worked!
    – Paladini
    Apr 16, 2018 at 17:41

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