TL, DR.
需要过多的准备工作,暂时放弃准备本地化的bottle for brew
针对每个formulae,大概需要这样的几个步骤:
- 每个formulae都有不同MacOS下的对应版本,需要都下载下来 from https://bintray.com/homebrew/bottles
- 针对对应的版本,需要知道对应都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 https://bintray.com/homebrew/bottles/pkg-config#files/, 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:
/Users/username/Library/Caches/Homebrew/downloads/dd6c78ec64b7c09961ccdb1bf873b5852fd93783cf25ae9b9399c5896a420462–pkg-config-0.29.2.mojave.bottle.tar.gz
for 10.13: it’s like:
/Users/username/Library/Caches/Homebrew/downloads/8b865a8ad8179d4a45289cab9267cc5e3a6153d06432d90cf1745caf5d92a64d–pkg-config-0.29.2.high_sierra.bottle.tar.gz
after that, brew can find the cached local file when you run brew install pkg-config
. otherwise, it will still download from a URL.
STF之Provider系列六:brew中提到需要利用brew安装STF的一些依赖,尝试使用本地方式进行安装。
结果证明 mv target.tar.file $(brew --cache)
的方式似乎没起其效果。STF之Provider一键部署一中的依赖应用的本地安装自然也不起效了。
brew安装前不自动更新HOMEBREW_NO_AUTO_UPDATE=1 brew install pkg-config
Homebrew provides pre-compiled versions for many formulae. These pre-compiled versions are referred to as bottles and are available at https://bintray.com/homebrew/bottles.
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, butbrew 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/
下也讲了。