15

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.

3
  • 1
    Is this what you seek? apple.stackexchange.com/questions/7984/…
    – bmike
    Jul 10, 2012 at 3:34
  • No, this is about specifying a new shell entirely (likely an updated version of the bash shell), not simply about changing to use bash. Jul 10, 2012 at 5:50
  • Oh yeah - thanks for digging up how to add a custom shell to the list of ones that are trusted by the OS.
    – bmike
    Jul 10, 2012 at 12:24

2 Answers 2

20

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
  • It worked. Thank you.
    – gubs
    Mar 13, 2020 at 17:25
17

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

1
  • this didn't work for me today (3 years on) but below did so switching accept. Jun 29, 2015 at 12:59

You must log in to answer this question.

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