Install Homebrew package and ignore md5 hash

I am trying to install some software using homebrew, and when downloading and trying to install one of the dependencies, the package won't install because of an MD5 mismatch.

Is it possible to get homebrew to ignore the MD5 hash of a file and carry on with the installation?


As one comment left on your OP mentioned: I'd be concerned that MD5 sums weren't matching. It could mean the tarball you're downloading is corrupt, in which case doing the above to override the match will actually cause you trouble because you'll be installing broken tools. Or it could be that the tarball you're downloading can't be trusted, that you're being given something that's not legit and contains potentially harmful routines. I'd make sure you're homebrew repository is up to date with:

brew update

If indeed it is up to date you can try:

brew install --force <package>

to force the installation. That option usually just forces a re-installation of an already-installed package of the same version but it may ignore an MD5 error. I poked through the install routine in homebrew but it wasn't apparent this would work.

Worse case: you could just download the tarball for the formula, calculate the MD5 for it by hand and then update the Formula file with the appropriate MD5 value to get past the check. For example, if you were having trouble installing dos2unix you find the formula file in /usr/local/Library/Formula/dos2unix.rb. At the top of the file is the tarball and the MD5 sum for it:

> more dos2unix.rb 
require 'formula'

class Dos2unix < Formula
  url 'http://waterlan.home.xs4all.nl/dos2unix/dos2unix-5.3.1.tar.gz'
  md5 '438c48ebd6891b80b58de14c022ca69e'
  homepage 'http://waterlan.home.xs4all.nl/dos2unix.html'

If the MD5 check is failing, download the tarball:

> wget http://waterlan.home.xs4all.nl/dos2unix/dos2unix-5.3.1.tar.gz
--2012-03-17 18:07:07--  http://waterlan.home.xs4all.nl/dos2unix/dos2unix-5.3.1.tar.gz
Resolving waterlan.home.xs4all.nl... 194.109.6.92, 2001:888:0:18::80
Connecting to waterlan.home.xs4all.nl|194.109.6.92|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 54967 (54K) [application/x-gzip]
Saving to: `dos2unix-5.3.1.tar.gz'

100%[==============================================================================================================>] 54,967      84.8K/s   in 0.6s    

2012-03-17 18:07:09 (84.8 KB/s) - `dos2unix-5.3.1.tar.gz' saved [54967/54967]

Calculate the MD5 checksum for the file yourself:

> md5 dos2unix-5.3.1.tar.gz 
MD5 (dos2unix-5.3.1.tar.gz) = 438c48ebd6891b80b58de14c022ca69e

And then enter the value you computed in to the formula file for the bundle and re-run the install command for the bundle.


I had the same issue just a few minutes ago with a formula I was trying to install. I tried running the install with the --force flag however that did not override the MD5 check (which makes sense TBH).

Following the advice given by Ian C. in his answer, I went ahead and ran 'brew update'. After that finished I was able to run the install for the formula I was attempting to install & it worked perfectly / there was no longer an MD5 mismatch.

Here's a link to a an issue in the Homebrew repo (this one regarding httrack, which was what I was attempting to install when I came across this) which basically just confirms that running 'brew update' should fix your issue.

https://github.com/mxcl/homebrew/issues/11242

If running 'brew update' does not fix the issue then either:

  • A) The MD5 hash within the formula is outdated & needs updated.
  • B) The download is not actually what is being expected and something is actually up.

In the case of A, you can update the formula yourself as Ian C. described - you're also definitely encouraged to submit a pull request to get it updated in the upstream repo for everyone to benefit, too!

In the case of B, the formula may be referencing an old URL or the download may be broken or referencing the wrong file, etc. - in this case you'll likely have to do some research and continue from there by contacting the project owner or similar.