1

How can I tell brew to skip trying to make calls to the Internet when installing locally?

I have downloaded the brew formula and bottle

user@host ~ % ls
wget-1.24.5.json
wget-1.24.5.rb
wget-1.24.5.ventura.bottle.tar.gz

According to the manual page man brew, you can specify the relative path to the recipe after brew install

   BREW(1)                              brew                              BREW(1)
    
    NAME
           brew - The Missing Package Manager for macOS (or Linux)
    
    SYNOPSIS
           brew --version
           brew command [--verbose|-v] [options] [formula] ...
    ...
    TERMINOLOGY
           formula
               Homebrew package definition that builds from upstream sources
    ...
       install formula
           Install formula.
    
           formula is usually the name of the formula to install, but it has other
           syntaxes which are listed in the SPECIFYING FORMULAE section.
    ...
    SPECIFYING FORMULAE
           Many Homebrew commands accept one  or  more  formula  arguments.  These
           arguments can take several different forms:
    
           The name of a formula
                  e.g. git, node, wget.
    
           The fully-qualified name of a tapped formula
                  Sometimes  a  formula from a tapped repository may conflict with
                  one in homebrew/core. You can still  access  these  formulae  by
                  using a special syntax, e.g. homebrew/dupes/vim or homebrew/ver-
                  sions/node4.
    
           An arbitrary file
                  Homebrew can install formulae from a local path. It can point to
                  either a formula file or a bottle. Prefix relative paths with ./
                  to prevent them from being interpreted as a formula or tap name.

As described in the documentation above, I execute the following

brew reinstall --verbose ./wget-1.24.5.rb

Unfortunaelty, the above command attempts to access the Internet. And when curl inevitably times-out, rather than using the bottle that's stored in the $HOMEBREW_CACHE, it just exits due to the network failure

user@host ~ %  brew reinstall --verbose ./wget-1.24.5.rb
curl: (28) Failed to connect to example.com port 9999 after 75004 ms: Couldn't connect to server
Failure while executing; `/usr/bin/env /usr/local/Homebrew/Library/Homebrew/shims/shared/curl --disable --cookie /dev/null --globoff --user-agent Homebrew/4.2.8\ \(Macintosh\;\ Intel\ Mac\ OS\ X\ 12.7.3\)\ curl/8.4.0 --header Accept-Language:\ en --fail --silent --remote-time --output /Users/runner/work/buskill-app/buskill-app/build/deps/api/formula.jws.json --location --disable --cookie /dev/null --globoff --show-error --user-agent Homebrew/4.2.8\ \(Macintosh\;\ Intel\ Mac\ OS\ X\ 12.7.3\)\ curl/8.4.0 --header Accept-Language:\ en --fail --silent --compressed --speed-limit 100 --speed-time 5 https://formulae.brew.sh/api/formula.jws.json` exited with 28. Here's the output:
curl: (28) Failed to connect to example.com port 9999 after 75004 ms: Couldn't connect to server
user@host ~ %  

How can I tell brew not to try to download formula.jws.json and instead just use the recipe that I've provided locally?

1 Answer 1

1

Try adding the following environment variables

export HOMEBREW_VERBOSE=1
export HOMEBREW_DEBUG=1
export HOMEBREW_NO_AUTO_UPDATE=1
export HOMEBREW_NO_INSTALL_FROM_API=1

In this case, the path to the formula file was wrong, but the output without the debug flag was worthless. Here's the error when I include the --debug flag:

user@host ~ %  brew reinstall --verbose --debug ./wget-1.24.5.rb
/usr/local/Homebrew/Library/Homebrew/brew.rb (Cask::CaskLoader::NullLoader): loading ./wget-1.24.5.rb
Warning: No available formula with the name "./wget-1.24.5.rb".

I fixed the issue by changing the ./ to the actual path where the wget-1.24.5.rb file lives.

And I was able to fix the attempts to download the formula.jws.json file with curl with the HOMEBREW_NO_INSTALL_FROM_API environment variable.

Finally, I realized that if you download the bottle, you don't even need the formula. You can link to it directly

brew reinstall --verbose --debug path/to/wget-1.24.5.ventura.bottle.tar.gz

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .