How to Work Around a 404 Error in Homebrew for macOS

how-to-work-around-a-404-error-in-homebrew-for-macos photo 1

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.

Step One: Find The File Homebrew Cannot

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.

how-to-work-around-a-404-error-in-homebrew-for-macos photo 2

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.

Step Two: Put The File in Homebrew’s Cache

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.

how-to-work-around-a-404-error-in-homebrew-for-macos photo 3

To get to this folder quickly you can press Command Shift and G in the Finder, then paste ~/Library/Caches/Homebrew.

how-to-work-around-a-404-error-in-homebrew-for-macos photo 4

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:

how-to-work-around-a-404-error-in-homebrew-for-macos photo 5

Homebrew now has access to the exact file it couldn’t find before.

Step Three: Run Brew Install Again

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:

how-to-work-around-a-404-error-in-homebrew-for-macos photo 6

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.

More stories