Skip to content

brew --prefix fails without an internet connection if HOMEBREW_CACHE is empty #24683

Description

@mrpippy

brew doctor output

% brew doctor
Please note that these warnings are just used to help the Homebrew maintainers
with debugging if you file an issue. If everything you use Homebrew for is
working fine: please don't worry or file an issue; just ignore this. Thanks!

Warning: Root certificates in /etc/ssl/cert.pem can trust compromised CAs.
Command-line tools using this file may accept forged TLS certificates:
  AAA Certificate Services
  emSign ECC Root CA - G3

Run this script to create a backup and remove these roots:
  sudo /opt/homebrew/Library/Homebrew/vendor/portable-ruby/4.0.9/bin/ruby --disable=gems,rubyopt /opt/homebrew/Library/Homebrew/utils/emudhra_certificates.rb

The script validates the bundle before replacing it. Removing the roots
can break HTTPS connections to some websites.

Run `brew doctor` afterwards and after system updates, which can restore
the roots.
For details and software update plans, see:
  https://support.apple.com/en-us/149555

Verification

  • I ran brew update twice and am still able to reproduce my issue.
  • I have supplied my brew doctor output above and it seems unrelated to my issue.
  • This issue's title and/or description do not reference a single formula e.g. brew install wget. If they do, open an issue at https://github.com/Homebrew/homebrew-core/issues/new/choose instead.
  • I did not use AI/LLM to create this issue, or I disclosed the tool and model used; I will answer maintainer questions myself without AI/LLM.

brew config output

% brew config
HOMEBREW_VERSION: 7.0.14
ORIGIN: https://github.com/Homebrew/brew
HEAD: c3286d37c37f71b186a7e6647092bf2b56d1d690
Last commit: 3 days ago
Branch: stable
Core tap: N/A
Core cask tap: N/A
HOMEBREW_PREFIX: /opt/homebrew
Homebrew Ruby: 4.0.9 => /opt/homebrew/Library/Homebrew/vendor/portable-ruby/4.0.9/bin/ruby
CPU: octa-core 64-bit arm_firestorm_icestorm
Clang: 21.0.0 build 2100
Git: 2.54.0 => /Volumes/GoldenGate/Applications/Xcode27.app/Contents/Developer/usr/bin/git
Curl: 8.7.1 => /usr/bin/curl
macOS: 27.2-arm64
CLT: 27.0.0.0.1788430756
Xcode: 27.0 => /Volumes/GoldenGate/Applications/Xcode27.app/Contents/Developer
Metal Toolchain: N/A
Rosetta 2: false

What were you trying to do (and why)?

If HOMEBREW_CACHE is empty and there's no internet connection, brew --prefix fails when trying to download API data.

brew --prefix is commonly called from other scripts (as evidenced by the formula_path.sh shell optimization) and I can't see why it would require an internet connection or cached API data. brew list works without an internet connection or cached API data, it seems like brew --prefix should too. HOMEBREW_CACHE is stored in ~/Library/Caches, and is liable to be deleted at any time.

What happened (include all command output)?

Run without an internet connection:

% rm -rf Library/Caches/Homebrew/api
% brew list                         
==> Formulae
pkgconf

% brew --prefix pkgconf             
==> Downloading Homebrew API data
✘ JSON API packages.arm64_golden_gate.jws.json
Error: Failure while executing; `/usr/bin/env /opt/homebrew/Library/Homebrew/shims/shared/curl --disable --cookie /dev/null --globoff --user-agent Homebrew/7.0.14\ \(Macintosh\;\ arm64\ Mac\ OS\ X\ 27.2\)\ curl/8.7.1 --header Accept-Language:\ en --fail --progress-bar --silent --remote-time --output /Users/pip/Library/Caches/Homebrew/api/internal/packages.arm64_golden_gate.jws.json.new --location --etag-save /Users/pip/Library/Caches/Homebrew/api/internal/packages.arm64_golden_gate.jws.json.etag.new --compressed --speed-limit 100 --speed-time 5 --write-out \%\{http_code\} https://formulae.brew.sh/api/internal/packages.arm64_golden_gate.jws.json` exited with 6. Here's the output:
000
==> Downloading https://formulae.brew.sh/api/internal/packages.arm64_golden_gate.jws.json
Error: Failure while executing; `/usr/bin/env /opt/homebrew/Library/Homebrew/shims/shared/curl --disable --cookie /dev/null --globoff --user-agent Homebrew/7.0.14\ \(Macintosh\;\ arm64\ Mac\ OS\ X\ 27.2\)\ curl/8.7.1 --header Accept-Language:\ en --fail --progress-bar --remote-time --output /Users/pip/Library/Caches/Homebrew/api/internal/packages.arm64_golden_gate.jws.json.new --location --etag-save /Users/pip/Library/Caches/Homebrew/api/internal/packages.arm64_golden_gate.jws.json.etag.new --compressed --speed-limit 100 --speed-time 5 --write-out \%\{http_code\} https://formulae.brew.sh/api/internal/packages.arm64_golden_gate.jws.json` exited with 6. Here's the output:
curl: (6) Could not resolve host: formulae.brew.sh

000

What did you expect to happen?

brew --prefix should work without an internet connection or cached API data

Step-by-step reproduction instructions (running brew commands)

Run without an internet connection:

% rm -rf Library/Caches/Homebrew/api
% brew list                         
==> Formulae
pkgconf

% brew --prefix pkgconf             
==> Downloading Homebrew API data
✘ JSON API packages.arm64_golden_gate.jws.json
Error: Failure while executing; `/usr/bin/env /opt/homebrew/Library/Homebrew/shims/shared/curl --disable --cookie /dev/null --globoff --user-agent Homebrew/7.0.14\ \(Macintosh\;\ arm64\ Mac\ OS\ X\ 27.2\)\ curl/8.7.1 --header Accept-Language:\ en --fail --progress-bar --silent --remote-time --output /Users/pip/Library/Caches/Homebrew/api/internal/packages.arm64_golden_gate.jws.json.new --location --etag-save /Users/pip/Library/Caches/Homebrew/api/internal/packages.arm64_golden_gate.jws.json.etag.new --compressed --speed-limit 100 --speed-time 5 --write-out \%\{http_code\} https://formulae.brew.sh/api/internal/packages.arm64_golden_gate.jws.json` exited with 6. Here's the output:
000
==> Downloading https://formulae.brew.sh/api/internal/packages.arm64_golden_gate.jws.json
Error: Failure while executing; `/usr/bin/env /opt/homebrew/Library/Homebrew/shims/shared/curl --disable --cookie /dev/null --globoff --user-agent Homebrew/7.0.14\ \(Macintosh\;\ arm64\ Mac\ OS\ X\ 27.2\)\ curl/8.7.1 --header Accept-Language:\ en --fail --progress-bar --remote-time --output /Users/pip/Library/Caches/Homebrew/api/internal/packages.arm64_golden_gate.jws.json.new --location --etag-save /Users/pip/Library/Caches/Homebrew/api/internal/packages.arm64_golden_gate.jws.json.etag.new --compressed --speed-limit 100 --speed-time 5 --write-out \%\{http_code\} https://formulae.brew.sh/api/internal/packages.arm64_golden_gate.jws.json` exited with 6. Here's the output:
curl: (6) Could not resolve host: formulae.brew.sh

000

Activity

  1. added theissue type on Nov 19, 2026
  2. self-assigned this
    on Nov 19, 2026
  3. added a commit that references this issue on Nov 19, 2026
    7b10e1d
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions