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

5

5

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?

Humism answered 10/8, 2022 at 4:30 Comment(6)
What does brew doctor output?Abigail
almost empty. but most errors I met is Error: openssl@3: Failed to download resource "ca-certificates_bottle_manifest" The downloaded GitHub Packages manifest was corrupted or modified (it is not valid JSON): Humism
Error: curl: Failed to download resource "ca-certificates_bottle_manifest" The downloaded GitHub Packages manifest was corrupted or modified (it is not valid JSON): /Users/user/Library/Caches/Homebrew/downloads/c95acf8107b31ec83053f411f74e85b2626e1a0c051467aff6b98acf996883d7--ca-certificates-2022-07-19_1.bottle_manifest.json Error: 'curl' must be installed and in your PATH! Failed during: /usr/local/bin/brew update --force --quiet any idea how to resolve it?Humism
Try uninstalling homebrew and then reinstalling it.Abigail
~ % /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/uninstall.sh)" curl: (77) error setting certificate verify locations: CAfile: /etc/ssl/certs/ca-certificates.crt CApath: noneHumism
This just happened to me as well--it was solved by removing all the faulty manifest.json files.Brotherhood
H
14

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

Humism answered 10/8, 2022 at 17:28 Comment(3)
Had a similar problem with a different package on my system (open-mpi), and deleting these cached downloads fixed it for me too.Maccarthy
Had the same problem with kbr5 & postgresql. You saved my day!Rhoads
For me the only thing that worked was to delete all files in the .../Homebrew/downloads/ directory, then run brew install curl. Thanks!Hydrodynamics
R
10

This command fixed the issue for me:

brew cleanup
Rosenfeld answered 15/12, 2022 at 12:16 Comment(1)
brew cleanup --prune=all to fix issues with corporate vpn replacing files with warningsWallywalnut
F
2

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

set HOMEBREW_FORCE_BREWED_CURL

Floriculture answered 10/8, 2022 at 4:47 Comment(1)
tried HOMEBREW_FORCE_BREWED_CURL=1 brew install openssl does not workHumism
C
2

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

Caty answered 11/8, 2022 at 8:40 Comment(2)
my prevoius download issue caused by my company vpn/proxy. After turn off company proxy, delete cached download, re-install again, the issue is resloved. Please pay attention whether you have some vpn/proxy is on.Humism
@Humism he was right for my issue. For me company vpn needed to be enabled since I am using company brew.Glossitis
C
1

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.

Capel answered 12/8, 2023 at 13:50 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.