4
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

brew install で「Error: Failed to download resource」エラーが出た時の対処

Last updated at Posted at 2021-08-19

brew install でパッケージをインストールしようとした際に、
実行した環境やパッケージ取得先の問題でインストールすることができず、
以下のようなエラーが発生することがあります。

Error: Failed to download resource

その際に取れる対処を以下に記載します。

brew update で formula 情報を最新にする

以下のコマンドを実行することで Homebrew 自体が更新され、
パッケージの取得先を記した formula も更新されます。

$ brew update

formula の URL 自体を書き換える

多くの場合は brew update の実行で解消すると思いますが、
それでもエラーが解消しない場合があります。

その際の対処として、対象パッケージの formula を編集し、
取得先 URL 自体を書き換える方法があります。

以下は glib の例。

$ brew edit glib
class Glib < Formula
  include Language::Python::Shebang

  desc "Core application library for C"
  homepage "https://developer.gnome.org/glib/"
# 正常にパッケージを取得できる、他のミラーサイトの URL を指定する
  url "https://mirror.umd.edu/gnome/sources/glib/2.68/glib-2.68.3.tar.xz"
# url "https://download.gnome.org/sources/glib/2.68/glib-2.68.3.tar.xz"
  sha256 "e7e1a3c20c026109c45c9ec4a31d8dcebc22e86c69486993e565817d64be3138"
  license "LGPL-2.1-or-later"

  bottle do
    sha256 arm64_big_sur: "f71020777f716cc22fe8f61eb3973d527bac8b34c3a7149b20cc314d901a16f6"
    sha256 big_sur:       "ebfa4f4aa16221f88df0259b2468c23a43d86a0c0fb5fb39b4ceb8cdebc3502a"
    sha256 catalina:      "8ee9768daf6642ca122ddb3aea294853c979ec8f3d89188cc7ff3c71c517460d"
    sha256 mojave:        "cf7cc5466d575b0c1a8c336770d0105c2624cbdb4a33716761b122b0a640cbe2"
    sha256 x86_64_linux:  "567a626270cda5d42994db048756571d28a3622e57a100455bb21044d65870b7"
  end

# 省略
4
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
4
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?