Login Shell

By Ronald Valente. Published

I have a love-hate relationship with GNU Bash. This mainly stems from macOS shipping an ancient version of bash which is the last GPLv2 version.

$ /bin/bash --version
GNU bash, version 3.2.57(1)-release (x86_64-apple-darwin17)
Copyright (C) 2007 Free Software Foundation, Inc.

So, we have a few options at this point…

Upgrade Bash

We could install a new version of bash:

brew install bash

Now we can see we're running bash 4.4.23, and we know that 4.4.23 > 3.2.57 because Math!

/usr/local/bin/bash --version
GNU bash, version 4.4.23(1)-release (x86_64-apple-darwin17.5.0)
Copyright (C) 2016 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>

This is free software; you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

Install ZSH

However, if you are installing a new shell, you could also try out a different shell with less electrons

brew install zsh

Configure macOS Allowed Shells

Regardless of what option you chose, you need to tell macOS that it is ok to new a non-standard shell location for your default shell.

Enumerate the available shells by running:

cat /etc/shells

The file will look similar to what is shown below.

# List of acceptable shells for chpass(1).
# Ftpd will not allow users to connect who are not using
# one of these shells.


If you want to use a custom shell that you installed with Homebrew (maybe you installed the latest ZSH) then you will have to edit that file.

# If you Upgraded Bash run this...
echo '/usr/local/bin/bash' | sudo tee -a /etc/shells

# If you installed ZSH run this...
echo '/usr/local/bin/zsh' | sudo tee -a /etc/shells

Set Your Default Shell

Note: There are a few ways to actually go about changing the login shell, a few of these options are chpass, chsh, using dscl, etc.

For this tip we will use chsh and change our login shell to zsh.

# If you Upgraded Bash run this...
# If you installed ZSH run this...

chsh -s /usr/local/bin/$NEWSHELL $(whoami)
Changing shell for _username_.
Password for _username_:

Close and re-open Terminal.app or iTerm.app and enjoy using your new default shell!