How to change the default Shell in Mac OSX

Changing the default shell in your Mac OSX environment is a pretty easy task. All you need to do is to use the chsh command.

Switching your current shell to e.g. bash can be done via

chsh -s /bin/bash  

The list of acceptable shells can be found in the /etc/shells file. By default this file should contain the following values

/bin/bash
/bin/csh
/bin/ksh
/bin/sh
/bin/tcsh
/bin/zsh

In case you installed tha latest bash version via brew and you want to use the latest version as the default login shell, you first need to add the homebrew managed bash into your list of accepted shells.

sudo bash -c 'echo /usr/local/bin/bash >> /etc/shells'  

Now you can switch your current shell to the newly added bash via

chsh -s /usr/local/bin/bash  

The above path is a symlink to the current bash version and should be kept up to date.

To find out what your current bash version is (the one you are using, not the installed), just type in

echo $BASH_VERSION  

Enjoy and happy bash-ing!

Andreas Fritzler

Data Jedi | Cloud and Big Data Expert | Machine Learning Enthusiast | Deep Learning Fanatic @SAP Opinions are my own