1
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 5 years have passed since last update.

Homebrew でChecksumエラー

Posted at

Homebrew のエラーについて

今回、Homebrew で emacsというエディタをインストールしようとしたところ、エラーが発生した。
おそらく gnutls を必要とするパッケージをインストールしようとした場合、同じことが起きるだろう。

$ brew install emacs
==> Installing dependencies for emacs: gnutls
==> Installing emacs dependency: gnutls
==> Downloading https://www.gnupg.org/ftp/gcrypt/gnutls/v3.6/gnutls-3.6.9.tar.xz
Already downloaded: /Users/username/Library/Caches/Homebrew/downloads/10375e457c78424d079bc03dc50b19e2d8f153be4087edde62a035a2627d8c6f--gnutls-3.6.9.tar.xz
==> Downloading https://gitlab.com/gnutls/gnutls/commit/ef80617d1e17e0878a909baad62a75ba265c0e00.patch
Already downloaded: /Users/username/Library/Caches/Homebrew/downloads/0c113ab0098bc4c3f2e8f410741b6104f2928fe63eb38cf98f8dcc3362f02ac4--ef80617d1e17e0878a909baad62a75ba265c0e00.patch
Error: An exception occurred within a child process:
 ChecksumMismatchError: SHA256 mismatch
Expected: 3b1634fa348c0f0064e43f3fb673e30a5e46f2b51cd6cd0d4a0cbf326e71c90e
 Actual: 34480b13120e2167060795060b6738c26622c341498cf6303b17b143642b14cd
Archive: /Users/username/Library/Caches/Homebrew/downloads/0c113ab0098bc4c3f2e8f410741b6104f2928fe63eb38cf98f8dcc3362f02ac4--ef80617d1e17e0878a909baad62a75ba265c0e00.patch
To retry an incomplete download, remove the file above.

Checksumが異なっているようなので、キャッシュに残っていたファイルが悪さをしたのかと思い、キャッシュを削除してみたが、同じエラーになった。

対策

調べてみると下記のHomebrewのGitHubにたどり着いた。

ここによると、パッチファイルの末尾にあるGitバージョンが正しくないようで、パッチファイルのバージョンを変更すればいいらしい。

私の環境ではパッチはログから見るとこちらにあるようなので、このパッチファイルを書き換えました。

/Users/username/Library/Caches/Homebrew/downloads/0c113ab0098bc4c3f2e8f410741b6104f2928fe63eb38cf98f8dcc3362f02ac4--ef80617d1e17e0878a909baad62a75ba265c0e00.patch

--- 上記ファイルの末尾のバージョンをこのように書き換える
2.22.0 → 2.21.0

再度 brew install してみるとうまくいきました。
おそらくいつか修正されると思う。
とりあえず、Checksumエラーの原因とかパッチ書き換えなどを自力でやることもあるんだなぁ、ということを覚えておけばいいかな。

1
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
1
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?