Change my shell to a different bash version at /usr/local/bin/bash?

How can I set my /usr/local/bin/bash (which is the 4.2 version that allows auto-completion of 'cd to directory with directory name') to be my default bash for a new window instead of my regular (v3.2.48) version.

I can type /usr/local/bin/bash and get into it but that's not the default for a new Terminal window which is what I want.


I don't know if this will populate in the terminal / advanced user account locations, but "The Way This Has Worked For Years"™ in Linux-land is that you must update /etc/shells with the path to the shell location, and then use chsh -s /usr/local/bin/bash username to use it.

Simply running chsh without modification to /etc/shells should cause an error indicating you've chosen an invalid shell, in case you're curious.

/etc/shells is a root-owned file, so you must use sudo in tandem with an editor in order to modify it. I hope you're comfortable doing that, else I would highly advise against trying out a non-default shell :).

Summary (steps):

  • brew install bash, then
  • sudo vi /etc/shells and add /usr/local/bin/bash to the list, then
  • chsh -s /usr/local/bin/bash [your_username] and restart your terminal in order for your changes to take place

1) go to "System Preferences" > "Users & Groups"

2) click the padlock icon and authenticate

3) right-click the icon for your user and select "Advanced Options..."

4) change the value for "Login shell" from "/bin/bash" to your preferred shell

enter image description here