macos安装错误_如何解决macOS的Homebrew中的404错误

macos安装错误_如何解决macOS的Homebrew中的404错误

macos安装错误

macos安装错误_如何解决macOS的Homebrew中的404错误

You’re installing some packages with Homebrew on your Mac, when you see a 404 error. Installation simply stops. Seriously?

看到404错误时,您正在Mac上使用Homebrew安装某些软件包 。 安装只是停止。 认真吗

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.

Homebrew团队通常擅长查找和修复404错误,因此运行brew update通常可以解决此类问题。 但是,如果这不起作用,并且您现在需要特定的应用程序,则可以自己解决该问题。 这是如何做。

第一步:找不到自制文件 (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.

您需要做的第一件事是找到丢失的文件。 通常,第一步是查看Homebrew尝试使用的下载URL,以找到托管项目的位置。

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.

在我的示例中,找不到的文件是mp4v2-2.0.0.tar.bz2,该文件托管在Google Code中。 这是Google最近关闭并存档的服务,这可能是问题所在。 为了进行调查,我转到mp4v2.googlecode.com ,该网站是Homewbrew尝试从其下载的,然后转到“下载”页面以找到我需要的文件。

macos安装错误_如何解决macOS的Homebrew中的404错误

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.

看来Google代码已更改了其下载网址,这就是Homebrew失败的原因。 没关系:我们可以在此处单击链接手动下载文件。

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.

跟踪所需文件的过程可能有所不同,具体取决于所需文件的存储位置,但是思路是相同的。 您需要转到托管项目的页面,然后下载Homebrew所需要的确切文件。

第二步:将文件放入自制软件的缓存中 (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.

现在已经有了文件,我们需要访问 Finder中隐藏的Library文件夹 ,然后转到Homebrew缓存。 从“库”文件夹中转到“缓存”>“自制”。

macos安装错误_如何解决macOS的Homebrew中的404错误

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

要快速进入此文件夹,您可以在Finder中按Command Shift和G,然后粘贴~/Library/Caches/Homebrew

macos安装错误_如何解决macOS的Homebrew中的404错误

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最近下载的一堆文件。 将刚刚下载的文件拖到文件夹中,使其与它们并排放置,如下所示:

macos安装错误_如何解决macOS的Homebrew中的404错误

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

Homebrew现在可以访问以前无法找到的确切文件。

第三步:再次运行Brew安装 (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:

困难的部分完成了! 像以前一样尝试安装该软件,Homebrew将在缓存中找到丢失的文件。 看起来像这样:

macos安装错误_如何解决macOS的Homebrew中的404错误

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.

如您所见,Homebrew认为它较早下载了文件,并使用它来完成安装。 现在,您可以返回需要做的非常重要的工作。 我感谢MyGeekDaddy.net上的Jason Verly指出了这一方便的解决方法。

翻译自: https://www.howtogeek.com/282147/how-to-work-around-a-404-error-in-homebrew-for-macos/

macos安装错误