The default macOS install of bash is 3.2. brew install bash
currently installs bash 5. How do you install bash 4?
-
Find the bash formula commit history: https://github.com/Homebrew/homebrew-core/commits/master/Formula/bash.rb
-
Find the latest commit that uses bash 4, for example:
bash: update 4.4.23 bottle.
and click “Browse files” -
Navigate to Formula/bash.rb, and click “Raw”
-
Copy the URL, and run
brew install <url>
so for example:
xxxxxxxxxx
brew install https://raw.githubusercontent.com/Homebrew/homebrew-core/32353d2286f850fd965e0a48bcf692b83a6e9a41/Formula/bash.rb
And that should install bash version 4.4.
Based off answer to SO question Homebrew install specific version of formula?