new2cpp
new2cpp

Reputation: 3667

brew install fails with 'The downloaded GitHub Packages manifest was corrupted or modified'

I'm trying to install curl via Homebrew using brew install curl.

However, the installation fails with:

The downloaded GitHub Packages manifest was corrupted or modified (it is not valid JSON

==> Downloading https://ghcr.io/v2/homebrew/core/brotli/manifests/1.0.9
Already downloaded: /Users/currentuser/Library/Caches/Homebrew/downloads/922ce7b351cec833f9bd2641f27d8ac011005f8b1f7e1119b8271cfb4c0d3cd7--brotli-1.0.9.bottle_manifest.json
Error: curl: Failed to download resource "brotli_bottle_manifest"
The downloaded GitHub Packages manifest was corrupted or modified (it is not valid JSON):
/Users/currentuser/Library/Caches/Homebrew/downloads/922ce7b351cec833f9bd2641f27d8ac011005f8b1f7e1119b8271cfb4c0d3cd7--brotli-1.0.9.bottle_manifest.json

What is the issue?

Upvotes: 5

Views: 20014

Answers (5)

Ermiya Eskandary
Ermiya Eskandary

Reputation: 23572

TLDR: ensure you can access https://ghcr.io/v2/homebrew/core


In my case, GitHub Packages (ghcr.io) was being blocked by our corporate firewall. By default, Homebrew uses https://ghcr.io/v2/homebrew/core as the download source for bottles. This source URL is set by the HOMEBREW_BOTTLE_DOMAIN environment variable.

The corporate firewall was intercepting the request for the GitHub Package manifest & responding with an HTML block page. Then, Homebrew stored and tried to parse the block page as a package manifest, which of course won't work. This results in the above 'corrupted' error.

To verify if this is the cause, try either of the below:

  • Open https://ghcr.io/v2/homebrew/core in a web browser to see if it's accessible or blocked
  • Change the manifest file extension e.g. xxx.bottle_manifest.json to .html and try opening it to see if it displays a block page
mv /Users/xxx/Library/Caches/Homebrew/downloads/xxx.bottle_manifest.json page.html
open page.html

You need to request for https://ghcr.io/v2/homebrew/core to be unblocked.

Upvotes: 1

Neetu
Neetu

Reputation: 121

This command fixed the issue for me:

brew cleanup

Upvotes: 10

user14550
user14550

Reputation: 31

I have also this problem with brew install php the problem persists even after deleting all the files from

/Users/currentuser/Library/Caches/Homebrew/downloads/

and

brew install php again

i have also tried

HOMEBREW_FORCE_BREWED_CURL=1 brew install openssl

Upvotes: 2

new2cpp
new2cpp

Reputation: 3667

The problem was resolved after delete /Users/currentuser/Library/Caches/Homebrew/downloads/922ce7b351cec833f9bd2641f27d8ac011005f8b1f7e1119b8271cfb4c0d3cd7--brotli-1.0.9.bottle_manifest.json and run brew install curl again

Upvotes: 14

jmvcollaborator
jmvcollaborator

Reputation: 2455

It might be using the installed curl instead of system curl. From man brew

set HOMEBREW_FORCE_BREWED_CURL

Upvotes: 2

Related Questions