The brew installer does a git clone of some very large repositories, which is slow.
It doesn't use:
brew update
being slower cf https://github.com/Homebrew/install/issues/541 , and 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 of brew update
.
wget -c https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh
sed -i 's:"git" "fetch":"git" "fetch" "--depth" "1":' ./install.sh
sed -i '/"update" "--force"/d' ./install.sh
When doing this, be sure to use HOMEBREW_NO_AUTO_UPDATE=1
and do not use brew update
.
To do the install, run
HOMEBREW_NO_AUTO_UPDATE=1 bash ./install.sh
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.