BASH Programming

How to Switch from Zsh to Bash on macOS, and Back Again

Zsh and bash are both popular Unix shells that are available on macOS while Zsh is the default shell on macOS Catalina and later versions, some users prefer to use Bash instead. Switching from Zsh to bash (and vice versa) is a straightforward process that can be done using either the terminal or the System Preferences. This article will outline both methods for switching between these shells on macOS.

How to List All the Shells in the macOS – Terminal Method

Before directly jumping towards switching the shells, it’s important to first list all the shells available on your macOS and for that just execute:

cat /etc/shells

How to Switch from Zsh to Bash on macOS – Terminal Method

One way to change the shell in macOS is by using its terminal, so just execute the below-given command and prompt the change by entering the password of your system:

chsh -s /bin/bash

Now just close the terminal and reopen it to apply the changes:

How to Switch from Bash to Zsh on macOS – Terminal Method

To again switch the shell on your macOS then just use the chsh command along with the name of the shell you want to shift previously we shifted the shell to bash and now to switch back to Zsh, execute:

chsh -s /bin/zsh

How to Switch from Zsh to Bash on macOS – System Preferences Method

Another way to switch the shell for Zsh to bash is by using the GUI of macOS for that here are some steps that you need to follow:

Step 1: For macOS Catalina (10.15.x) and lower, Open System Preferences and click on Users& Groups:

Step 2: Click on the lock icon and enter the password to modify the settings:

Step 3: Right-click on the user and then open the Advanced Options:

Step 4: In the Advanced Options; from the Login shell drop-down menu, select /bin/bash:

Similarly, to go back to the Zsh from System Preferences, repeat the same procedure, and simply select /bin/zsh.

Further, if you have the latest macOS on your system that is Ventura then below are the steps that you need to follow:

Step 1: In the latest macOS (Ventura) go to System Settings, and click on Users & Groups:

Step 2: Next right click on the user’s name to get the Advanced Options:

Step 3: Enter the password and then from the Login shell, select the desired shell.

Note: macOS X offers various other shells also, such as csh, tcsh which can also be switched from the terminal and System Preferences/System Settings.

Conclusion

Switching between Zsh and bash on macOS can be done quickly and easily using either the terminal or the System Preferences. Both methods are straightforward and can be completed in just a few simple steps. Whether you prefer Zsh or bash, being able to switch between the two shells can help you customize your user experience and make the most of your mac.

About the author

Aaliyan Javaid

I am an electrical engineer and a technical blogger. My keen interest in embedded systems has led me to write and share my knowledge about them.