Monday, December 22, 2025

command line – How to force brew to install from local formula (without internet access)

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?

Related Articles

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Latest Articles