Install Newer BASH on macOS

From Bonus Bits
Jump to: navigation, search

Purpose

This article gives the steps to install latest homebrew BASH on macOS that is running BASH 3.x.

Gnome-sticky-notes-applet As of writing this article there wasn't a way to specify an older version of Bash. I got the latest and greatest Homebrew formula which was 5.0.7. Really I wanted 4.4.x to match a client etc. The older version didn't seem to be available (i.e. brew install bash@4.4)

Prerequisites


Environment

  • macOS 10.14.5
  • Homebrew 2.1.6


List Bash Version

bash --version


Install

brew update && brew install bash


Setup Shell

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


Switch to New Shell

chsh -s /usr/local/bin/bash


Set in Profile (Optional)

I didn't have to add this. It launches 5.0.7 without it for me.

bash -c 'echo chsh -s /usr/local/bin/bash >> $HOME/.bash_profile'


Sources