The brew installer does a git clone of some very large repositories, which is slow.
It doesn't use:
- shallow clones because GitHub asked them not to so-as to avoid
brew updatebeing slower c.f. https://github.com/Homebrew/install/issues/541, and - partial clones are not supported yet c.f. https://github.com/Homebrew/brew/issues/13188
In a CI environment where brew update is not needed, how can the brew installer be forced to use a shallow clone to speed up the operation?
The installer can be hacked to use shallow clone. Then an error occurs when the installer tries to run
brew update. So the steps are fetch the installer script, force using shallow clone, and remove the use ofbrew update.When doing this, be sure to use
HOMEBREW_NO_AUTO_UPDATE=1and do not usebrew update.To do the install, run