Also the latest MacOS (High Sierra) provide an outdated bash version (from 2007) I would like to install the latest version without
homebrew or similar tools!
I would keep the system as minimal as possible because it will be used to build software. There should be no big difference from a regular MacOS installation.
Download the latest
bash source from GNU.org, compile and install it!
$ cd /tmp/ $ curl -O http://ftp.gnu.org/gnu/bash/bash-4.4.12.tar.gz
Extract it, your version may be newer!
$ tar xzf bash-4.4.12.tar.gz $ cd bash-4.4
All not system defaults are installed in
/usr/local in my case.
$ ./configure --prefix=/usr/local $ make $ sudo make install
Add the new shell to the list of legit shells:
$ sudo "echo /usr/local/bin/bash >> /private/etc/shells"
Change the default shell for the user:
$ chsh -s /usr/local/bin/bash