12
brew install php55
==> Downloading http://www.php.net/get/php-5.5.11.tar.bz2/from/this/mirror
######################################################################## 100.0%
Error: SHA256 mismatch
Expected: 60e14c255f2a461a7a26639b84a2fc448cc2f91c8dead0e9fd00cd8ba27a2e96
Actual: 0d9438c2557db5809f4232148ca1567516e7ece9bf8726853ceac4a111cb8690
Archive: /Library/Caches/Homebrew/php55-5.5.11
To retry an incomplete download, remove the file above.

I tried

brew cleanup && brew update

but not worked

kenorb
  • 155,785
  • 88
  • 678
  • 743
WildCat
  • 1,961
  • 6
  • 24
  • 35

10 Answers10

20

I had the same problem with MongoDb. I was able to fix it first I changed the permission to admin.

Then I ran

brew cleanup && brew update

After that I ran

brew install mongodb 

and it worked like a charm

Meh
  • 339
  • 2
  • 5
12

I also tried brew cleanup and brew update but still got the same issue so i did this

brew edit <application>

and replaced sha256 value with actual value shown in error msg.

and this worked out for me, hope it helps you too.

ankitkhandelwal185
  • 1,023
  • 1
  • 15
  • 24
5
Error: libvirt: SHA256 mismatch
Expected: ac06a7b7a74cf83e953f50e33455df97fc87880ebdac4f1dca89a62331375b1a
  Actual: 3346ebf9df9fc4dd37b4c0a5bf1ce80a577b97a7a48dac3febf22aa857be9a98
    File: /Users/mek/Library/Caches/Homebrew/downloads/6287efc2ec4d5147e8389b97caeb20dd0d4acec390b5910b2454a4dd018654c1--libiscsi--1.19.0.big_sur.bottle.tar.gz
To retry an incomplete download, remove the file above.

To resolve above error run below commands:

  • rm "filename"
  • brew install "package" -f
user17802661
  • 51
  • 1
  • 1
2

I had the same problem with watchman.

brew install watchman

response for :

==> Installing dependencies for watchman: automake, pcre

==> Installing watchman dependency: automake

==> Downloading https://ftp.gnu.org/gnu/automake/automake-1.16.1.tar.xz Already downloaded:

/Users/piccolo/Library/Caches/Homebrew/automake-1.16.1.tar.xz

==> Downloading https://git.savannah.gnu.org/cgit/automake.git/patch/?id=a348d83 Already downloaded:

/Users/piccolo/Library/Caches/Homebrew/automake--patch-7a57ca2b91f7f3c0b168cf5ffbc8a1b2168f3886bcadcc15412281472dace3ce.git

Error: SHA256 mismatch Expected:

7a57ca2b91f7f3c0b168cf5ffbc8a1b2168f3886bcadcc15412281472dace3ce

Actual:

c048ce853eef073a5dfce34fcf9af786e8525e384e01dbbf4e6066623985d4c7

Archive:

/Users/piccolo/Library/Caches/Homebrew/automake--patch-7a57ca2b91f7f3c0b168cf5ffbc8a1b2168f3886bcadcc15412281472dace3ce.git

To retry an incomplete download, remove the file above.

then I did this:

brew uninstall automake
brew cleanup
brew update
brew install watchman

Then it worked.

刘俊利
  • 358
  • 4
  • 12
1

Some one face the same issue. https://github.com/Homebrew/homebrew-php/issues/875

"I checked the downloaded file, and it's the html download page rather than the tarball.

It looks like php now wants the URLs to be in the form of http://www.php.net/get/php-5.4.22.tar.bz2/from/a/mirror instead of http://www.php.net/get/php-5.4.22.tar.bz2/from/this/mirror

EDIT: I'm totally mistaken with this. from/this/mirror is the correct one, but it's borked on php's side."

firelyu
  • 2,102
  • 5
  • 25
  • 29
1

I got fix, using steps wrote by MoOx:

cd /Library/Caches/Homebrew/downloads/

and delete manually the package and run againbrew upgrade works fine!

Vader
  • 123
  • 7
1

This can happen if a corporate security policy intercepts the request to the cask and responds with an Access Blocked page instead. You can tell by seeing the file's URL rewritten and its content being HTML. In that case you have to ask them to relax the policy or you're out of luck.

Noumenon
  • 5,099
  • 4
  • 53
  • 73
0

Sometimes, you may have a package that have a new SHA (eg: github updated the way it compress tar.gz), so best thing to do is to fix the original formula (you can try locally and also push your change upstream).

MoOx
  • 8,423
  • 5
  • 40
  • 39
0

Also ran into this just recently, turned out my proxy settings had been removed somehow, so double checking could be helpful.

Eric
  • 81
  • 1
  • 5
0

Title: MongoDB Installation Error: SHA256 Mismatch

Description: I encountered an error while trying to install MongoDB using Homebrew on my macOS system. The error message I received was "mongodb-community: SHA256 mismatch." I managed to resolve the issue using the following steps. I'm sharing this solution to help others who might face the same problem.

Steps:

Open a Terminal Window: Open a terminal window on your macOS system. You can do this by using the Terminal application or pressing Command + Space and then typing "Terminal" to search for it.

Open a New Terminal Tab: To run the commands concurrently, open a new terminal tab. You can do this by pressing Command + T.

Edit MongoDB Database Tools Formula: In the new terminal tab, run the command brew edit mongodb-database-tools. This will open the formula for editing.

Enter Edit Mode: Press i on your keyboard to enter insert/edit mode in the terminal. You'll see that you can now modify the text.

Replace the SHA256 Key: Find the section of the formula where the SHA256 key is specified. Copy the actual SHA256 key from the error message or the formula and replace the existing SHA256 key with it.

Save and Exit: After replacing the SHA256 key, press Esc to exit the insert mode. Then, type :wq and press Enter to save the changes and exit the editing mode.

Install MongoDB Community: Now, you can go back to your original terminal window and run the command brew install mongodb-community.

Verify Installation: After the installation is complete, you can verify the installation by running mongo --version in the terminal. You should see the version information of MongoDB.

By following these steps, I was able to resolve the "SHA256 mismatch" error and successfully install MongoDB using Homebrew. I hope this solution helps others who might encounter the same issue.