How to know which is my default Shell in MacOS?
Okay, during the last updates of MacOS the default settings of the shell we are using as a default has changed. This may affect your development configurations, paths, and other settings. Let’s find out in BigSur which Shell are we having as default.
On the Terminal, find out with:
$ echo $SHELL
If the answer you get is:
/bin/zsh > your default terminal is zsh and the settings file you have to modify is: ~/.zshrc
Otherwise, if you get:
/bin/bash > the settings you can manage in ~/.bash_profile
To add for example permanent aliases on each one you can open and edit on it with:
$ nano ~/.bash_profile
or
$ nano ~/.zshrc
In this editor, write your changes, one command per line.
Keep changes with Ctrl +O and confirm the file to keep it with Enter.
To exit, type Ctrl + X.
Or, you can also open with your default code editor ( $ code <file> and keep). Now, we have to read this setting on the launch, so close and kill processes or type:
source ~/.zshrc
or
source ~/.bash_profile
You can find all the able shells to use with the command:
$ cat /etc/shells
# List of acceptable shells for chpass(1). # Ftpd will not allow users to connect who are not using # one of these shells.
/bin/bash
/bin/csh
/bin/dash
/bin/ksh
/bin/sh
/bin/tcsh
/bin/zsh
You will see the list of all you have installed on your system already, to set one as default we have to set the bin file, as for example you want to go back to default to bash:
$ chsh -s /bin/bash
If were the case you want to install a new bash, then add it in the /bin folder and as well, write on the catalog of allowed bashes, like:
$ sudo nano /etc/shells
Finally set as default. That’s all the msitery around the new defualt bashes on MacOS since Catalina to BigSur.
Extra tip, to check the version on your current shell version, type the shell name like bash or zsh followed of the -- version command: