How to change default shell to bash on Macos Catalina

I noticed that my default shell set to zsh on Macos Catalina/Big Sur. How do I change my default shell to bash on Macos Catalina or above using the command line or GUI options?

A Unix shell is nothing but a program that accepts Unix commands from the keyboard and executes them. For a long time, the bash was a default shell in macOS. However, Apple replaced Bourne Again SHell with Z shell for licensing reasons. This page explains how to set up bash as your default login shell and interactive shell on macOS Catalina, “Big Sur” and above.
Tutorial details
Difficulty level Easy
Root privileges No
Requirements macOS OS and Terminal app
Est. reading time 2 minutes

How to set default shell to bash on Macos Catalina

The procedure is as follows:

  1. Open the terminal application.
  2. List available shells by typing cat /etc/shells.
  3. To update your account to use bash run chsh -s /bin/bash.
  4. Close terminal app.
  5. Open the terminal app again and verify that bash is your default shell.
Let us see all commands and examples in details.

List your shell options on Unix

You must only include shells listed in the /etc/shells file. Otherwise, your account will get locked up when an invalid shell name or path is specified. Hence, always verify paths. Simply run the following cat command:
cat /etc/shells
macOS Catalina set zsh as default shell

How to change your zsh to bash on macOS

Simply type the following command:
chsh -s /bin/bash
Set and change default shell to bash
Close the terminal Window and reopen it again. Next you need to type the following command to make sure your user account is configured to use zsh on Unix using the printf command/echo command:
echo "$SHELL"
OR
printf "%s\n" "$SHELL"
Sample outputs:

/bin/bash

Of course, you are not limited to bash. We can see a list of all other shell installed by using the cat command and then use that shell:
# get a list
cat /etc/shells
# Change to ksh
chsh -s /bin/ksh
## OR fish shell if installed on your Mac ##
chsh -s /usr/local/bin/fish

See “How do I find out what shell I am using on Linux/Unix?” for other commands-line tips and tricks.

Find out your bash version

Type the following command:
bash --version
Sample outputs:

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

I am using bash version 3.2.57 on macOS.

How do I update or upgrade bash version?

Homebrew installs the apps you need that Apple didn’t include in their base operating system or app store such as cutting edge version of gnu/bash. See how to install Homebrew on macOS to use the brew package manager

Homebrew user can type the following brew command to install the latest version of bash on Catalina:
brew install bash
The newer version of bash is located at /usr/local/bin/bash:
ls -l /usr/local/bin/bash
cat /etc/shells

If not in /etc/shells, append it:
sudo -i
echo /usr/local/bin/bash >> /etc/shells

We can use the which command or type command/command command to locate a command path on macOS or Unix-like operating systems. For instance, get the pathnames of the files (or links) which would be executed in the current environment:

type -a bash
which bash
command -v bash

Set default shell to /usr/local/bin/bash, run the following chsh command chsh -s /usr/local/bin/bash
How to upgrade bash version on Macos Catalina
Verify new gnu/bash version:
bash --version
/usr/local/bin/bash --version

Sample outputs:

GNU bash, version 5.0.11(1)-release (x86_64-apple-darwin19.0.0)
Copyright (C) 2019 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.

Conclusion

You learned how to set and use bash as the default shell on your Mac Catalina as Apple changed the default from bash to zsh.


🐧 Get the latest tutorials on Linux, Open Source & DevOps via RSS feed or Weekly email newsletter.

🐧 4 comments so far... add one

CategoryList of Unix and Linux commands
Disk space analyzersncdu pydf
File Managementcat
FirewallAlpine Awall CentOS 8 OpenSUSE RHEL 8 Ubuntu 16.04 Ubuntu 18.04 Ubuntu 20.04
Network UtilitiesNetHogs dig host ip nmap
OpenVPNCentOS 7 CentOS 8 Debian 10 Debian 8/9 Ubuntu 18.04 Ubuntu 20.04
Package Managerapk apt
Processes Managementbg chroot cron disown fg jobs killall kill pidof pstree pwdx time
Searchinggrep whereis which
User Informationgroups id lastcomm last lid/libuser-lid logname members users whoami who w
WireGuard VPNAlpine CentOS 8 Debian 10 Firewall Ubuntu 20.04
4 comments… add one
  • CF Sep 25, 2020 @ 5:36

    This is so confusing. I’m just changing my shell to zsh on Catalina, as I thought was the right thing to do. Why are you doing the opposite? Thank you.

    • 🐧 Vivek Gite Sep 25, 2020 @ 9:44

      Because I like bash and I do all my scripting in bash.

  • Huyen Dinh Nov 17, 2020 @ 21:38

    This was a great guide, thanks so much :)

  • AA Mar 12, 2021 @ 22:55

    Should change it to fish instead 🐟

Leave a Reply

Your email address will not be published.

Use HTML <pre>...</pre> for code samples. Still have questions? Post it on our forum