You’re installing some packages with Homebrew on your Mac, when you see a 404 error. Installation simply stops. Seriously?
The Homebrew team is generally good about finding and fixing 404 errors, so running brew update will generally solve such problems. But if that doesn’t work, and you need a particular application right now, you can work around the issue yourself. Here’s how.
The first thing you need to do is find the missing file. Generally the first step is to look at the the download URL Homebrew tried to use to find where the project is hosted.
In my example, the file that couldn’t be found was mp4v2-2.0.0.tar.bz2, which is hosted at Google Code. That’s a service Google shut down and archived recently, which might be the problem. To investigate, I head to mp4v2.googlecode.com, the site Homewbrew tried to download from, then head to the “Downloads” page to find the file I need.
It seems like Google Code has changed the URLs for their downloads, which is why Homebrew failed. No matter: we can download the file manually right here by clicking the link.
Your process for tracking down the file you need might look a little different, depending on where the files you need are stored, but the idea is the same. You need to head to the page where the project is hosted and download the exact file Homebrew was looking for.
Now that we’ve got the file, we need to access the hidden Library folder in the Finder, then head to the Homebrew cache. From the Library folder go to Caches > Homebrew.
To get to this folder quickly you can press Command Shift and G in the Finder, then paste ~/Library/Caches/Homebrew.
You’ll see a bunch of files that Homebrew has recently downloaded. Drag the file you just downloaded to the folder so it’s alongside them, like this:
Homebrew now has access to the exact file it couldn’t find before.
The hard part is done! Attempt to install the software just like you did before, and Homebrew will find the missing file in the cache. Here’s what that looks like:
As you can see, Homebrew thinks it downloaded the file earlier, and uses it to complete the installation. You can now get back to whatever very important work it is that needs doing. My thanks to Jason Verly over at MyGeekDaddy.net for pointing out this handy workaround.
Justin Pot is a technology writer and enthusiast who lives in Portland, Oregon. Follow him on Twitter and Facebook, if you want. You don’t have to.