Upgrade Bash to 4+ on OS X

Unfortunately, Apple has decided to ship an old version of bash shell. When I go back and forth between linux and OSX sometimes I hit minor inconsistencies because of this. One big one is the git-prompt scripts. As such I finally decided to upgrade to version 4 of bash.
It is a very easy process, 2 minutes, and you are on your way. First, though you need homebrew installed and up-to-date.

Steps

Installation

1
brew install bash

Add it to Your Shells

You need to add it to your shells which is easy. Add the following line to `/etc/shells`
1
/usr/local/bin/bash

Change Your Shell

1
chsh
change the line that has Shell to the location that your newly brew installed bash is located.
1
Shell: /usr/local/bin/bash

Restart Terminal

Close your terminal and open it again.

Verification

To see your current version of bash do the following:
1
echo $BASH_VERSION
It should echo something like `4.2.45(2)-release`

Conclusion

It is that simple. I though it would be hard until I did it.
Previous
Next Post »