Changing Mac zsh to bash - rajivkanaujia/alphaworks GitHub Wiki

Background

Mac's default shell in Catalina onwards is set to zsh. Irrespective of the reasons, I want to change my default shell to bash. There are command line options to do so too.

How to change to bash?

Find out list of available shells

$ 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

How to change to bash via command line

$ chsh -s /bin/bash

$ bash --version
GNU bash, version 3.2.57(1)-release (x86_64-apple-darwin19)
Copyright (C) 2007 Free Software Foundation, Inc.

Although you can use brew to upgrade to latest version of bash, I plan to stick to the one that came with Mac.

  • $brew install bash --> Install bash
  • $ls -l /usr/local/bin/bash --> location of the installation
  • $cat /etc/shells --> Find out if the new location is in the shells
  • $sudo -i --> get sudo access
  • $echo /usr/local/bin/bash >> /etc/shells --> update the shells
  • $chsh -s /usr/local/bin/bash --> change to the one installed by brew

How to change to bash via UI (Global Setting)

  • Go to System Preferences --> Users & Groups

  • Hold down the control (ctrl) key and click the User Name to open Advanced Options, and click it.

  • Select the right "bash"

How to change to bash via UI for Terminal App only

  • Open Terminal App

  • Change the properties and use bash


Note: If you like the instructions here, please refer it on your posts/documentation. Contact me if there are corrections needed.