A Unix shell is a program that accepts Unix commands and executes them. In macOS, Bash was the default shell for a long time, but it was replaced with Z shell due to licensing reasons. If you prefer to use Bash as your default login and interactive shell, follow the steps below:
-
Open the Terminal application on your macOS Catalina.
-
List the available shells by running the following command in the Terminal:
cat /etc/shellsThis will display a list of acceptable shells for your system.
-
To update your account and set Bash as the default shell, use the
chshcommand:chsh -s /bin/bash -
Close the Terminal application.
-
Reopen the Terminal app to verify that Bash is now your default shell.
Listing Available Shells on Unix
To view your shell options on Unix, run the following command:
cat /etc/shells
Sample output:
/bin/bash
/bin/csh
/bin/dash
/bin/ksh
/bin/sh
/bin/tcsh
/bin/zsh
Changing from Zsh to Bash on macOS
To change from Z shell (Zsh) to Bash on macOS, run the following command in the Terminal:
chsh -s /bin/bash
Close the Terminal window and reopen it. To confirm that your user account is now configured to use Bash, use the printf or echo command:
echo $SHELL
or
printf "%s\n" $SHELL
Sample output:
/bin/bash
Finding Your Bash Version
To check your Bash version, type the following command in the Terminal:
bash --version
Sample output:
GNU bash, version 5.0.11(1)-release (x86_64-apple-darwin18.6.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.
Also, you can visit (https://vmbs.uk/t/how-to-update-or-upgrade-bash-version-on-macos/67).