26

This seems like a very noob question but I can't find an answer anywhere!

I'm very new to developing packages for Homebrew but when I edit my formula and come to update my package I get the following error

Error: SHA256 mismatch

My question is, how do I generate the expected SHA256 value?

2 Answers 2

44

After editing the formula, you can run brew fetch your-formula --build-from-source to fetch the tarball and display the new checksum. If you've already downloaded the tarball somewhere, you can calculate the hash with openssl sha256 < some_tarball.tar.gz or shasum -a 256 some_tarball.tar.gz.

1
  • How would I know that the tarball I downloaded wasn't corrupted? Isn't the only way to know for sure is by having the package maintainer provide the SHA256 themselves? For example, pypi.python.org/pypi/awsebcli only provides an MD5. Is it expected I verify my download matches the MD5, and then I generate the SHA256?
    – davekaro
    Nov 29, 2015 at 15:04
0

For casks, I prefer to change the cask sha256 to something wrong and then run brew cask fetch {caskName}, which then throws an error that shows the "Actual" sha256 for the downloaded file. You can just copy and paste that.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.