link on JianShu


需要过多的准备工作,暂时放弃准备本地化的bottle for brew


  • 每个formulae都有不同MacOS下的对应版本,需要都下载下来 from
  • 针对对应的版本,需要知道对应都cached路径是什么,可以通过brew --cache --force-bottle formulae获取到适用于当前MacOS版本的缓存地址
  • 在不同到MacOS上重复执行上面两步,才能获取到不同版本下可用的缓存地址

如何使用源码进行安装,可以先将源码包下载下来,然后复制到cache目录下 pre-download a formula mv source-code.tar.gz $(brew --cache -s formulaName


The brew bottle is MacOS version-related.

Take pkg-config for example.

here on, it lists different files for different MacOS version.

After downloading the correct file, you need to move it to correct path which can be generated by brew --cache --force-bottle pkg-config

for 10.14: it’s like:


for 10.13: it’s like:


after that, brew can find the cached local file when you run brew install pkg-config. otherwise, it will still download from a URL.


结果证明 mv target.tar.file $(brew --cache)的方式似乎没起其效果。STF之Provider一键部署一中的依赖应用的本地安装自然也不起效了。

brew安装前不自动更新HOMEBREW_NO_AUTO_UPDATE=1 brew install pkg-config

brew 安装为什么都进行编译操作

Homebrew provides pre-compiled versions for many formulae. These pre-compiled versions are referred to as bottles and are available at

If available, bottled binaries will be used by default except under the following conditions:

  • Options were passed to the install command, i.e. brew install <formula> will use a bottled version of the formula, but brew install --enable-bar <formula> will trigger a source build.
  • The --build-from-source option is invoked.
  • The machine is not running a supported version of macOS as all bottled builds are generated only for supported macOS versions.
  • Homebrew is installed to a prefix other than the standard /usr/local(although some bottles support this).

We aim to bottle everything.

还是要多看官方文档啊。 为什么brew把包默认安装/usr/localbin/下也讲了。

brew Manpage

comments powered by Disqus