01 October 2014

Update bash on OS X using homebrew

Default bash on MAC OS X sucks, that's why we have to get a better one. The easiest way is using homebrew.

First step is to install homebrew
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
then install bash
brew install bash
after that, you can go to see if new bash is install correctly
ls -al /usr/local/bin | grep bash
The result should show the symlink (->) like this
lrwxr-xr-x   (some useless info here)  bash -> ../Cellar/bash/4.3.18/bin/bash
The version might not be exactly 4.3.18, but everything above that is okay.

Now it's time to update your bash by create symlink to /usr/bin/bash.
But, before we can create symlink, just in case something go wrong, we have to backup the existing bash first.
sudo mv -r /usr/bin/bash /usr/bin/bash_old
then crete symlink from /usr/local/bin/bash to /usr/bin/bash
sudo ln -s /usr/local/bin/bash /usr/bin/bash 
After you restart terminal, everything should be ready

If you're still not convince, you can try
bash --version