macOS Catalina and later versions use Zsh as the default shell, but many developers still prefer Bash due to its familiarity, compatibility, and simplicity. If you need to switch from Zsh to Bash on macOS, this guide will walk you through the process step-by-step.


Why Switch from Zsh to Bash?

While Zsh offers advanced features like better autocompletion and customization, Bash remains a popular choice for several reasons:

  1. Widespread Adoption: Bash is the default shell on most Unix-like systems, making it a reliable choice.
  2. Compatibility: Many scripts and tools are written with Bash in mind, ensuring seamless integration.
  3. Simplicity: Bash has a smaller learning curve, especially for those who don’t need advanced features.

Step-by-Step Guide to Switch from Zsh to Bash

1. Verify Your Current Shell

Open Terminal and run the following command to check your current default shell:

1
echo $SHELL

If the output is /bin/zsh, you are currently using Zsh.

2. List Available Shells

Run the following command to see all available shells on your system:

1
cat /etc/shells

You should see /bin/bash listed among the available shells.

3. Change Your Default Shell

To switch to Bash permanently, use the chsh (change shell) command:

1
chsh -s /bin/bash

You will be prompted to enter your password. After entering it, the default shell will be changed to Bash.

4. Relaunch Terminal

Close the current Terminal window and open a new one. This ensures that the changes take effect. You can verify that Bash is now the default shell by running:

1
echo $SHELL

The output should now be /bin/bash.


Customizing Your Bash Environment

After switching to Bash, you can customize your shell environment using the .bash_profile or .bashrc file. These files are located in your home directory and allow you to set aliases, environment variables, and customize the command prompt.

For example, to add a custom alias, open your .bash_profile file in a text editor:

1
open -a TextEdit ~/.bash_profile

Add your custom alias, such as:

1
alias ll='ls -la'

Save the file and reload the configuration by running:

1
source ~/.bash_profile

Frequently Asked Questions

Q: Can I switch back to Zsh later?

A: Yes, you can switch back to Zsh at any time by running:

1
chsh -s /bin/zsh

Then relaunch Terminal.

Q: Do I need to reinstall Bash?

A: No, Bash is pre-installed on macOS. You only need to change the default shell.

Q: Will my custom configurations be lost?

A: No, your custom configurations will remain intact. You can migrate your settings from .zshrc to .bash_profile if needed.