How to install a local file in Homebrew

You see a post or tweet and the author is talking about this really cool program they discovered. You find out the program can be installed via Homebrew,1 so you add it to your 'Putzing Project List'.2

When you get time to work on your project, you fire your computer to install the package and get this:


Thankfully there is a way to manually download the package and have Homebrew use the local file to install the program.

Manual Brew Install

When you install a program with Homebrew it will download an archive file (gzip, bz2, tar, etc.) of the package to your computer first. Normally this happens automagically with the Homebrew install process, but sometimes you'll run into a problem with the default URL. Here's a work around on how to install a package with a manually downloaded archive file.

  1. Locate the project homepage for the program you're trying to install. Typically you'll be able to go back to the URL listed when the install failed. In my example I went back to to find the archive package file.
  2. Check to see if you can download the package from your browser from the primary repository. Make sure you're downloading the same version that Homebrew believes it should install, even if there is a new version. Leave this file to your Downloads folder for now.
  3. Sometimes you hit an outage (e.g. maintenance schedule) for the main repository. If you can't download the archive file from the main source, double check if there is a mirror and grab the archive file from there. Again, make sure you grab the same version that Homebrew wants to install.
  4. Determine where Homebrew would normally download the archive file to, so you know where to put the manually downloaded file. Open a Terminal window and enter brew --cache. This will give a path on where the archive file would normally be saved to before getting installed. In my case the path is /Users/mygeekdaddy/Library/Caches/Homebrew.
  5. Copy/move the archive file from Downloads to the folder path you found with the brew --cache command.
  6. Re-run the Homebrew install command - brew install qemu. Homebrew will notice you already have the file downloaded and run the rest of the install process using the local file.

Boom! The program installs and you're ready to work on your new project. If you run into any problems, double check for any dependencies that aren't being met or specific errors when Homebrew was trying to compile the package.

Beyond that... Google is your new friend for an answer.

FWIW: The qemu package I was trying to install is a processor emulator I want to use to a version of Raspian Linux on my Mac. This way I can test Raspberry Pi projects when I'm away from my home work bench.

  1. Because you already use Homebrew, right? 

  2. Because you have one of these too.