I do not recommend change of SHELL for root. Let's make it safe if
brew upgrade will go bad.
Mac OS is using bash version 3. Or to be exact it's using
/bash/sh which is:
sh-3.2# sh --version GNU bash, version 3.2.48(1)-release (x86_64-apple-darwin12) Copyright (C) 2007 Free Software Foundation, Inc.
Nowadays it's good to use bash v4 because it has some awesome things like associative arrays:
declare -A array array[foo]=bar array[bar]=foo
And more you can read in NEWS file.
So to upgrade bash to version 4 on our osx we need brew (kinda obvious).
Then we need to install bash:
brew install bash
Next we need to add our bash to shells:
sudo bash -c "echo $(brew --prefix)/bin/bash >> /private/etc/shells"
And the last step is to change our shell in system preferences so go to:
system preferences -> Users & Groups (unlock pref pane) -> right click on your account Advanced Options... and change
Login shell option to
Reboot your computer and have fun with your new bash ;)