Suppressing "The default interactive shell is now zsh" message in macOS Catalina

I know Catalina uses zsh as the default login shell and interactive shell, but it is very annoying when I open iTerm.app or run command with /bin/bash, it shows verbose message like below:

$ /bin/bash
The default interactive shell is now zsh.
To update your account to use zsh, please run `chsh -s /bin/zsh`.
For more details, please visit https://support.apple.com/kb/HT208050.

The support document the message links to is https://support.apple.com/kb/HT208050

How can I hide the verbose logging? I do not want to be reminding that the "default interactive shell is now zsh" every time I open Terminal.


Solution 1:

I found the solution on reddit. The solution is also mentioned in the "How to use a different shell without changing the default" section of the Apple support article mentioned in the bash warning: https://support.apple.com/en-us/HT208050/.

Add:

export BASH_SILENCE_DEPRECATION_WARNING=1

to $HOME/.bash_profile, $HOME/.profile or $HOME/.bashrc and restart iTerm. After that, the warning message will be gone.

Solution 2:

Apple's /bin/bash is fairly antiquated (currently v3.2.57). I just switch to use the bash shipped by homebrew (currently v5.0.18), which will incidentally also remove that deprecation warning.

Steps:

  1. Install Homebrew if you haven't already.
  2. Install the latest bash shell with Homebrew:
brew update && brew install bash
  1. If you have an Apple Intel computer, change the shell like this:
sudo chsh -s /usr/local/bin/bash $(whoami)

Or if you have Apple Silicon (e.g. M1):

sudo chsh -s /opt/homebrew/bin/bash $(whoami)