Written by
Amanda WongThe 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
- Head to Finder > Applications > Utilities, and launch Terminal.
- Type the command line below. echo $0
- Press Enter and it displays the shell your Mac is using.
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:
- Use Spotlight search on Mac to open Terminal.
- Type the following command and press Enter. chsh -s /bin/bash
- Type your admin password and press Enter again.
- 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
(Full Guide) Remove 'The default interactive shell is now zsh.'
This post explains what "The default interactive shell is now zsh." on Monterey/Big Sur/Catalina is and three ways to remove the message, including steps to change the shell to zsh. Read more >>
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:
- Head to the Apple menu and choose System Settings(Redesigned System Preferences).
- Move the left sidebar and find Users & Groups, click it.
- Right-click on a user account you want to make changes to and select Advanced Options...
- Enter your admin password to unlock the preferences.
- Locate the Login shell label, expand the box, and choose bin/bash.
- Click the OK button to confirm your operation.
On macOS Monterey and earlier:
- Click on the Apple logo and select System Preferences.
- Choose the Users & Groups section.
- Click the lock on the bottom left and unlock it with your admin password.
- Right-click on your account and select Advanced Options…
- Set the Login shell as /bin/bash.
- 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.
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)
This post explains bin files on Mac and the usr/local/bin folder. Plus, it guides you on how to access usr/local/bin on Mac in Finder or Terminal.
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!