Homebrew 本地安装

Homebrew 是一款很强大的软件包管理工具,可以方便的安装和卸载软件以及对软件统一管理。

但有些软件通过 Homebrew 下载很慢,但通过迅雷等软件下载很快,所以就有了本文的需求。

例如:mono-mdk

1
brew cask install mono-mdk

半天下载不下来,但通过迅雷,几分钟就可以下载完毕。

1
https://download.mono-project.com/archive/6.10.0/macos-10-universal/MonoFramework-MDK-6.10.0.104.macos10.xamarin.universal.pkg

brew 本地安装步骤如下:

  1. 将下载下来的文件放到 brew 缓存目录。

    1
    2
    3
    4
    5
    brew --cache 

    # 输出本地缓存,一般位置 ~/Library/Caches/Homebrew
    # 将下载下来文件移动到缓存路径 download 目录,并重命名成没有下载下来的文件名。
    # 例如:75e79c06910b0d10c33bba8f59780bb7ea105219dc1d700826de031f7c25cde3--MonoFramework-MDK-6.10.0.104.macos10.xamarin.universal.pkg
  2. 重新执行安装命令,检测到缓存文件已存在,即可跳过下载直接开始安装。

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    brew cask install mono-mdk

    ==> Caveats
    Installing mono-mdk removes mono and mono dependant formula binaries in
    /usr/local/bin and adds mono-mdk to /private/etc/paths.d/
    You may want to:

    brew unlink {formula} && brew link {formula}

    and/or remove /private/etc/paths.d/mono-commands

    ==> Downloading https://download.mono-project.com/archive/6.10.0/macos-10-universal/MonoFramework-MDK-6.10.0.104.macos10.xamarin.universal.pkg
    Already downloaded: /Users/pwrd/Library/Caches/Homebrew/downloads/75e79c06910b0d10c33bba8f59780bb7ea105219dc1d700826de031f7c25cde3--MonoFramework-MDK-6.10.0.104.macos10.xamarin.universal.pkg
    ==> Verifying SHA-256 checksum for Cask 'mono-mdk'.
    ==> Installing Cask mono-mdk
    ==> Running installer for mono-mdk; your password may be necessary.
    ==> Package installers may write to any location; options such as --appdir are ignored.
    Password:
    installer: Package name is Mono Framework
    installer: Installing at base path /
    installer: The install was successful.
    mono-mdk was successfully installed!