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 Mar 6 '13 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? – echristopherson Mar 6 '13 at 2:48
  • @echristopherson Your method worked. If you post it as an answer, I'll accept it. – MD6380 Mar 7 '13 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 Mar 7 '13 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 Jul 31 '13 at 19:58

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).

  • 2
    Homebrew folder does not exist, but it works after I mkdir one. – eccstartup Oct 17 '13 at 14:57
  • brew install didn't work for me, but brew install <package> did. Thanks! – Zayne S Halsall May 16 '16 at 11:59
  • Oh, I had left that implicit. I'm fixing that in my answer. – echristopherson May 16 '16 at 19:12
$ 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:~$ – Zayne S Halsall May 16 '16 at 11:57
  • 2
    same error happens – Ben Sep 6 '16 at 7:51

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>)
  • This works for the current version of a formual — but if I want to reinstall node 11 rather than the current node 12, brew --cache -s node still gives me the path for node 12. Do you know how I can force Homebrew to install the older version? – John Y Jun 17 '19 at 16:14
  • This is the one that works with latest brew version 2.2.1 – LnxSlck Dec 13 '19 at 23:59

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).

  • 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 Aug 15 '19 at 12:24

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


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 – Hasnaa Ibraheem Apr 30 '20 at 7:35

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

You must log in to answer this question.

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