I use brew utility for all my terminal based installation needs. However recently I had to deal with a corrupted brew install. To fix this I followed this link. The uninstallation and reinstallation worked fine and I now have a working brew instance.
The commands as mentioned in the above link are:
$ cd `brew –prefix`
$ rm -rf Cellar
$ brew prune
$ rm -rf Library .git .gitignore bin/brew README.md share/man/man1/brew
$ rm -rf ~/Library/Caches/Homebrew
$ ruby -e “$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)”