homebrew
Summary
Section titled “Summary”Installs Homebrew itself (macOS/Linux package manager) via Zinit, keeps it updated, links its Zsh completion, generates and sources the shell environment script.
Syntax / Usage
Section titled “Syntax / Usage”zi for \ as'null' \ atclone'%atpull' \ atpull' ./bin/brew update --preinstall \ && ln -sf $PWD/completions/zsh/_brew $ZINIT[COMPLETIONS_DIR] \ && rm -f brew.zsh \ && ./bin/brew shellenv --dummy-arg > brew.zsh \ && zcompile brew.zsh' \ depth'3' \ nocompletions \ sbin'bin/brew' \ src'brew.zsh' \ homebrew/brewDetails
Section titled “Details”as'null'— disables the default script-sourcing and completion installation.atclone'%atpull'— runs theatpullhook at initial clone time as well as on updates.atpull— on each update: runsbrew update --preinstall, symlinks the Zsh completion into Zinit’s completions directory, regeneratesbrew.zshwithbrew shellenv, and compiles it for faster loading.depth'3'— performs a shallow clone with 3 levels of history to speed up the initial clone.nocompletions— suppresses Zinit’s default completion detection since the completion is managed manually via the symlink inatpull.sbin'bin/brew'— creates a shim for thebrewbinary (requireszinit-annex-bin-gem-node).src'brew.zsh'— sources the generated shell environment script (setsHOMEBREW_PREFIX,PATH,MANPATH, etc.) on shell startup.
The annex zdharma-continuum/zinit-annex-bin-gem-node must be loaded before this recipe.
Examples
Section titled “Examples”# prerequisite — load once at the top of .zshrczinit light-mode for zdharma-continuum/zinit-annex-bin-gem-node
zi for \ as'null' \ atclone'%atpull' \ atpull' ./bin/brew update --preinstall \ && ln -sf $PWD/completions/zsh/_brew $ZINIT[COMPLETIONS_DIR] \ && rm -f brew.zsh \ && ./bin/brew shellenv --dummy-arg > brew.zsh \ && zcompile brew.zsh' \ depth'3' \ nocompletions \ sbin'bin/brew' \ src'brew.zsh' \ homebrew/brewCaveats / Common Mistakes
Section titled “Caveats / Common Mistakes”- This recipe manages Homebrew itself through Zinit. It is not required if Homebrew is already installed via its official installer; in that case, simply source the output of
brew shellenvdirectly in.zshrc. - The
atpullhook runsbrew update --preinstallon everyzinit update, which performs a network call. This may slow downzinit update --all.