Mac brew install gradle一直卡

2020-10-02 16:00:28

先到官網下載gradle最新版

https://gradle.org/releases

執行brew install gradle

brew install gradle
==> Downloading https://services.gradle.org/distributions/gradle-6.6.1-all.zip
==> Downloading from https://downloads.gradle-dn.com/distributions/gradle-6.6.1-
###                                                                        5.5%^C

卡 ~卡~卡 直接取消就好了,然後輸入下面命令

brew --cache gradle
/Users/way/Library/Caches/Homebrew/downloads/1aae952c51910aa4f2d6f13f80dcfc90ece8a11490f5e43cc8ee880755b65dc9--gradle-6.6.1-all.zip

重點來了

把下載好的gradle直接複製到/Users/way/Library/Caches/Homebrew/downloads路徑下面,名字替換成1aae952c51910aa4f2d6f13f80dcfc90ece8a11490f5e43cc8ee880755b65dc9–gradle-6.6.1-all.zip.incomplete
替換好後繼續

brew install gradle
brew install gradle
==> Downloading https://mirrors.tuna.tsinghua.edu.cn/homebrew-bottles/bottles/op
Already downloaded: /Users/way/Library/Caches/Homebrew/downloads/183892c67b2607e4fa70e2cd709aad507b3fcbfb3a68b064639190017f8219fe--openjdk-14.0.1.high_sierra.bottle.tar.gz
==> Downloading https://services.gradle.org/distributions/gradle-6.6.1-all.zip
Already downloaded: /Users/way/Library/Caches/Homebrew/downloads/1aae952c51910aa4f2d6f13f80dcfc90ece8a11490f5e43cc8ee880755b65dc9--gradle-6.6.1-all.zip.incomplete.zip
Error: SHA256 mismatch
Expected: 11657af6356b7587bfb37287b5992e94a9686d5c8a0a1b60b87b9928a2decde5
  Actual: 04e1f6983335781032814c4537534fbca89a57799eda0c6567845f552c5315d5
 Archive: /Users/way/Library/Caches/Homebrew/downloads/1aae952c51910aa4f2d6f13f80dcfc90ece8a11490f5e43cc8ee880755b65dc9--gradle-6.6.1-all.zip.incomplete.zip
To retry an incomplete download, remove the file above.

提示sha256校驗不對

brew edit gradle
lass Gradle < Formula
  desc "Open-source build automation tool based on the Groovy and Kotlin DSL"
  homepage "https://www.gradle.org/"
  url "https://services.gradle.org/distributions/gradle-6.6.1-all.zip"
  sha256 "11657af6356b7587bfb37287b5992e94a9686d5c8a0a1b60b87b9928a2decde5"
  license "Apache-2.0"

  livecheck do
    url "https://services.gradle.org/distributions/"
    regex(/href=.*?gradle[._-]v?(\d+(?:\.\d+)+)-all\.(?:[tz])/i)
  end

  bottle :unneeded

  depends_on "openjdk"

  def install
    rm_f Dir["bin/*.bat"]
    libexec.install %w[bin docs lib src]
    (bin/"gradle").write_env_script libexec/"bin/gradle", Language::Java.overridable_java_home_env
  end

<cal/Homebrew/Library/Taps/homebrew/homebrew-core/Formula/gradle.rb" 33L, 1014C

直接用之前提示實際sha256替換掉sha256 「11657af6356b7587bfb37287b5992e94a9686d5c8a0a1b60b87b9928a2decde5」

OK

brew install gradle
==> Downloading https://services.gradle.org/distributions/gradle-6.6.1-all.zip
Already downloaded: /Users/way/Library/Caches/Homebrew/downloads/1aae952c51910aa4f2d6f13f80dcfc90ece8a11490f5e43cc8ee880755b65dc9--gradle-6.6.1-all.zip.incomplete.zip
🍺  /usr/local/Cellar/gradle/6.6.1: 10,630 files, 249.3MB, built in 19 seconds
==> `brew cleanup` has not been run in 30 days, running now...
Removing: /Users/way/Library/Caches/Homebrew/mono--6.8.0.105.high_sierra.bottle.tar.gz... (142.6MB)
Removing: /Users/way/Library/Caches/Homebrew/paket--5.236.0.exe... (8.3MB)
Removing: /Users/way/Library/Logs/Homebrew/paket... (64B)
Removing: /Users/way/Library/Logs/Homebrew/mono... (64B)
Pruned 1 symbolic links and 10 directories from /usr/local