简体   繁体   中英

How to install brew using a shallow clone (especially useful in CI systems)

The brew installer does a git clone of some very large repositories, which is slow.

It doesn't use:

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM