To remove old versions of installed formulas and see them during their removal, simply run:
brew cleanup -n
to remove erlang (if you are having problems) just
brew uninstall erlang
to install the latest version of erlang after that
brew update brew install erlang
source share