homebrew - force install even with SHA1 mismatch

Sean Connolly picture Sean Connolly · Oct 6, 2013 · Viewed 9.8k times · Source

I'm installing something through homebrew but one of it's dependencies is failing to install, saying that the downloaded artifact has a different SHA1 checksum than what homebrew expects. The culprit is suite-sparse v4.2.1 and from checking the homebrew issue tracker, it seems the owner of this package has a tendency to make changes without bumping versions.

I have a ticket in with the homebrew experts to double check this package and vet the new SHA1. In the meantime..

Is it possible to force homebrew to install a package even if the SHA1 is incorrect?

I don't mind doing a little manual installing, so long as the package remains homebrew friendly and a future brew update will update to the latest version without issues.

Answer

Alexander McFarlane picture Alexander McFarlane · Sep 24, 2014

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.