I'm trying to use Homebrew to install wget, but something is happening where the download is always corrupt. This happens for all packages, not just wget. I can download the tar.gz fine through a browser. Can I use Homebrew to install a locally downloaded archive? Something such as:

brew install wget-1.14.tar.gz 
  • 2
    Seems very odd. I don't know of you can do that but it sounds like something more serious is happening. Have you tried running brew doctor?
    – boyfarrell
    Commented Mar 6, 2013 at 2:45
  • If you have the exact archive that Homebrew's expecting, you can put it in ~/Library/Caches/Homebrew and then try brew install. But this is mysterious. How about posting the output of brew install when you try it the normal way? Commented Mar 6, 2013 at 2:48
  • @echristopherson Your method worked. If you post it as an answer, I'll accept it.
    – MD6380
    Commented Mar 7, 2013 at 17:34
  • I know why it doesn't work. Brew doctor doesn't show any issues. It looks like the HTTP proxy being used isn't allowing the download.
    – MD6380
    Commented Mar 7, 2013 at 17:35
  • Just to note, this is useful when there are multiple mirrors and the one in the recipe doesn't work. You can set a different SourceForge mirror via an environment variable, but for others the accepted solution is very useful.
    – Dan
    Commented Jul 31, 2013 at 19:58

10 Answers 10


If Homebrew already has a formula for it (in /usr/local/Library/Formula), and you have the exact archive that the formula expects (i.e. same file name and same contents, as determined by SHA1 or whatever hash type the formula uses), you can put the archive in ~/Library/Caches/Homebrew and then try brew install formula_name (substituting the correct name for formula_name, of course).

  • 3
    Homebrew folder does not exist, but it works after I mkdir one.
    – eccstartup
    Commented Oct 17, 2013 at 14:57
  • brew install didn't work for me, but brew install <package> did. Thanks! Commented May 16, 2016 at 11:59
  • Oh, I had left that implicit. I'm fixing that in my answer. Commented May 16, 2016 at 19:12
  • @echristopherson Can you please update this answer with an example command (eg for wget), including the command's execution output? It's not clear, for example, if formula_name includes the version number or the .rb extension. Commented Mar 26 at 17:41

It is possible to pre-download a file for a formula but you will need correct cache file name which can be generated using brew --cache -s <formula>.

For example, for Erlang formula, brew --cache -s erlang will print the correct name of the cached download. This means instead of manually renaming a formula, you can run:

wget source-version.tar.gz
mv source-version.tar.gz $(brew --cache -s <formula>)

To handle specific versions other than latest, connect the relevant version to the formula name with an @.

mv source-version.tar.gz $(brew --cache -s <formula>@<version>)

For example:

mv node-v16.20.2.tar.xz $(brew --cache -s node@16)
$ brew install -f wget-1.14.tar.gz
  • 2
    Different package but same requirement, -f doesn't appear to work: zaynehalsall@mbp:~$ brew install -f Library/Caches/Homebrew/pwgen-2.07.tar.gz Error: No available formula with the name "Library/Caches/Homebrew/pwgen-2.07.tar.gz" ==> Searching for similarly named formulae... Error: No similarly named formulae found. ==> Searching taps... Error: No formulae found in taps. zaynehalsall@mbp:~$ Commented May 16, 2016 at 11:57
  • 2
    same error happens
    – Ben
    Commented Sep 6, 2016 at 7:51
  • Interesting, it works on some packages but not all. Beware that if deletes your package after installation.
    – Nande
    Commented May 4, 2021 at 23:21
  • It works on files named like "app-x.y.system.bottle.tar.gz" if the file is simply called "app-x.y" it won't work, some can be renamed to the bottle format. (im assuming that you might have packages that are not a bottle and those wont work but i dont know that much) Beware that if deletes your package after installation.. so its better to move them to the download folder, add the sha256 and link them.
    – Nande
    Commented May 5, 2021 at 0:45

Five years and change late to the party, but:

The trick is to move the archive into brew's cache. Said cache can be a pain to find by hand; fortunately, you don't have to. Just ask brew itself with brew --cache.

This lets you do the following in bash:

mv wget-1.14.tar.gz $(brew --cache)

alternately, in fish:

mv wget-1.14.tar.gz (brew --cache)

After which running brew install wget should result in brew announcing that it's downloading the archive, followed immediately by its realization that the archive is "Already downloaded", and everything proceeding smoothly from there.


According to this:

Not really without modifying the formula file.

if your local archive is pre-build file, aka 'bottle' in Brew. Here is what I dig out:

The brew bottle is MacOS version-related.

Take pkg-config for example.

here on https://bintray.com/homebrew/bottles/pkg-config#files/, it lists different files for different MacOS version.

After downloading the correct file, you need to move it to correct path which can be generated by brew --cache --force-bottle pkg-config

for 10.14: it's like:


for 10.13: it's like:


after that, brew can find the cached local file when you run brew install pkg-config. otherwise, it will still download from a URL.

just move file to $(brew --cache) won't work anymore, at least for today's brew( 2.19 version in my case).

  • 1
    if the local file is source code, not a bottle. Moving it to $(brew --cache -s formula) will work if you force to install it with option --build-from-source .
    – gebitang
    Commented Aug 15, 2019 at 12:24

Brew updated its caching strategy, you need put the downloaded file into ~/Library/Caches/Homebrew/downloads, and follow its naming convention.

You can let brew start the download, then you will see a .incomplete file, e.g. 544b4d734091aeb6482dbe2496a8ff223d15bc970fa330d3dccbb0bb6fb0e13e--qemu-4.2.0.catalina.bottle.tar.gz.incomplete, then you can rename your file into 544b4d734091aeb6482dbe2496a8ff223d15bc970fa330d3dccbb0bb6fb0e13e--qemu-4.2.0.catalina.bottle.tar.gz.

  • I tried to do that renaming trick, but brew validates the SHA and detects that there is something wrong, it tended to build the project and its dependencies, so be careful. Using version 2.2.14 Commented Apr 30, 2020 at 7:35

According to https://github.com/Homebrew/homebrew-cask/issues/21346

but now the source location is changed, you can search download_strategy.rb in your computer

my location is "/usr/local/Homebrew/Library/Homebrew" enter image description here

and then lock the rb source file (or it will use git tool to restore itself)

when try to use "brew install xxx" in terminal, you will get the whole file cache path location: enter image description here


Put your brew tarballs in some directory, then set that directory to be your cache directory using the HOMEBREW_CACHE environment variable or specify it with the --cache argument

--cache [options] [formula]

Display Homebrew’s download cache. See also HOMEBREW_CACHE.

If formula is provided, display the file or directory used to cache formula.

-s, --build-from-source: Show the cache file used when building from source.
--force-bottle: Show the cache file used when pouring a bottle.
--formula: Only show cache files for formulae.
--cask: Only show cache files for casks.


HOMEBREW_CACHE: Use the specified directory as the download cache.

Default: macOS: $HOME/Library/Caches/Homebrew, Linux: $XDG_CACHE_HOME/Homebrew or $HOME/.cache/Homebrew.

Source: https://docs.brew.sh/Manpage#--cache-options-formula

  1. Run

    brew install -b <formulae>
  2. If a package fails to download, look for the cached location name and the url to download

    Downloading https://mirrors.edge.kernel.org/pub/software/scm/git/git-2.31.1.tar.xz
    incomplete https://mirrors.edge.kernel.org/pub/software/scm/git/git-2.31.1.tar.xz
    curl: (35) SSL peer handshake failed, the server most likely requires a client certificate to connect

    Note 3 things from the response:

  3. Download the package by visiting the download url

  4. After downloading, change the name of the file to Cached file name exactly and put that file in the Cache folder location.

  5. Run brew install again

    brew install -b <formulae>

That did it for me! You might have to do these steps a couple of time if there are several packages you can't download with brew install.


Some of the answers here seem a little out of date. For the most up to date answer check the official Homebrew Documentation under Tips and Tricks - Pre-download a file for a formula.

As of today, the most relevant part is:

The command brew --cache --build-from-source <formula> will print the expected path of the cached download, so after downloading the file, you can run mv the_tarball "$(brew --cache --build-from-source <formula>)" to relocate it to the cache.

You must log in to answer this question.

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