I had a problem like this when installing gcc48 / gcc49 or any version of gcc through brew. The problem was with libmpc08:
Error: SHA1 mismatch
Expected: 5ef03ca7aee134fe7dfecb6c9d048799f0810278
Actual: 5900fdfc7894c52ce7a3ab7ea6ebd29af22f0b70
Archive: /Library/Caches/Homebrew/libmpc08-0.8.1.tar.gz
To retry an incomplete download, remove the file above.
I solved the problem by editing the expected sha1 entry in the brew formula with the command brew edit [formula]
I downloaded the libmpc08 file directly from the server specified by brew and used mv
to copy it into /Library/Caches/Homebrew/
with the filename expected by brew. The same error occurred with the SHA1 mismatch but the download appeared to be correct as I had downloaded it and checked the contents.
Using brew edit libmpc08
brings up the formula in native text editor. I found the line:
sha1 '5ef03ca7aee134fe7dfecb6c9d048799f0810278'
and changed it to
sha1 '5900fdfc7894c52ce7a3ab7ea6ebd29af22f0b70'
Saved and ran brew install gcc49
installation went ahead perfectly.