sajad torkamani

Install via Homebrew

brew install bash

See the Homebrew page for bash for the Bash version that the above command will installl. At the time of writing, this is 5.3.9:

Upgrade bash on macOS

Make new bash version your default

Run the below command to see the path for the bash binary just installed via Homebrew:

which bash

Add that to the end of /etc/shells.

For me, which bash returns:

/opt/homebrew/bin/bash

So I add that to the end of /etc/shells: