Home > News Tips

How to Change Default Shell to Bash on Your Mac?

Updated on Tuesday, December 3, 2024

iBoysoft author Amanda Wong

Written by

Amanda Wong
Professional tech editor

Approved by

Jessica Shee

English

The shell is the command-line interface (CLI) and interpreter for the set of commands used to interact with the operating system. Zsh (Z shell) and bash(Bourne-again Shell) are the two options for Mac's default shell. It depends on the macOS versions you're running. 

On macOS Mojave and earlier, the default shell is bash, however, Apple switched from zsh to bash since macOS Catalina partly because bash is now under the GPL v3 license which is incompatible with Apple's policies and zsh is closer to the functionality of the standard bash.

How to tell what shell your Mac is using

  1. Head to Finder > Applications > Utilities, and launch Terminal
  2. Type the command line below. echo $0
  3. Press Enter and it displays the shell your Mac is using.

check shell on mac

on macOS Ventura, Monterey, Big Sur, and Catalina, the default shell is zsh now, but some Mac users want to change zsh to bash on Mac given that they have used bash for a long time and are used to it or they need to execute the bash script on Mac. Whatever the case, you are covered in this post.

Change zsh to bash for the interactive shell

An interactive shell responds to user commands and shows results to the user. You can change the interactive shell from zsh to bash with Terminal commands. Here's how:

  1. Use Spotlight search on Mac to open Terminal.
  2. Type the following command and press Enter. chsh -s /bin/bash
  3. Type your admin password and press Enter again.
  4. Restart your Mac to complete the change.

If you want to switch back to zsh from bash, use the command below:

chsh -s /bin/zsh

Change zsh to bash for login shell

When a user logs into their user account, they are given a shell known as a login shell. Mac users can switch the shell from zsh to bash for the login shell within a few steps.

On macOS Ventura:

  1. Head to the Apple menu and choose System Settings(Redesigned System Preferences).
  2. Move the left sidebar and find Users & Groups, click it.
  3. Right-click on a user account you want to make changes to and select Advanced Options...
  4. Enter your admin password to unlock the preferences.unlock user and groups on ventura
  5. Locate the Login shell label, expand the box, and choose bin/bash.
  6. Click the OK button to confirm your operation.change login shell bash on ventura

On macOS Monterey and earlier:

  1. Click on the Apple logo and select System Preferences.
  2. Choose the Users & Groups section.
  3. Click the lock on the bottom left and unlock it with your admin password.
  4. Right-click on your account and select Advanced Options…change default shell on monterey
  5. Set the Login shell as /bin/bash.
  6. Click OK and restart your Mac.

Already changed zsh to bash with the steps above? Share it with others now!

 

Update bash shell on macOS

But keep in mind that the Bash (Bourne Again SHell) version that comes with macOS is still somewhat outdated. Bash 3.2, the last version with GPLv2(the GNU General Public License v2) is included in all versions of macOS while Bash 5.0 is the most recent version. However, Bash 4.0, the successor of Bash 3.2, began to use GPLv3, which Apple doesn't support.

check bash version on mac

You can check the version of the bash shell on your Mac by running the command $ bash --version on macOS Catalina/Big Sur/Monterey/Ventura. And there is a way out to update the bash shell on macOS for obtaining its advanced functions. It is recommended to install Homebrew on Mac to update the bash.

Once you have completed the Homebrew installation, run the command below to update bash on Mac:

brew update && brew install bash && sudo chsh -s /usr/local/bin/bash $(whoami)

Conclusion

It is not that hard to change zsh to bash as we have guided you step by step in this post. You can also switch back to zsh from bash after you complete the tasks requiring for bash shell on your Mac. In addition, you also know how to update bash on macOS from this post.

If you think this post is helpful, share it with more people!