1 if (( ! $+commands[brew] )); then
2 if [[ -x /opt/homebrew/bin/brew ]]; then
3 BREW_LOCATION="/opt/homebrew/bin/brew"
4 elif [[ -x /usr/local/bin/brew ]]; then
5 BREW_LOCATION="/usr/local/bin/brew"
6 elif [[ -x /home/linuxbrew/.linuxbrew/bin/brew ]]; then
7 BREW_LOCATION="/home/linuxbrew/.linuxbrew/bin/brew"
8 elif [[ -x "$HOME/.linuxbrew/bin/brew" ]]; then
9 BREW_LOCATION="$HOME/.linuxbrew/bin/brew"
14 # Only add Homebrew installation to PATH, MANPATH, and INFOPATH if brew is
15 # not already on the path, to prevent duplicate entries. This aligns with
16 # the behavior of the brew installer.sh post-install steps.
17 eval "$("$BREW_LOCATION" shellenv)"
21 if [[ -z "$HOMEBREW_PREFIX" ]]; then
22 # Maintain compatability with potential custom user profiles, where we had
23 # previously relied on always sourcing shellenv. OMZ plugins should not rely
24 # on this to be defined due to out of order processing.
25 export HOMEBREW_PREFIX="$(brew --prefix)"
28 alias bcubc='brew upgrade --cask && brew cleanup'
29 alias bcubo='brew update && brew outdated --cask'
30 alias brewp='brew pin'
31 alias brewsp='brew list --pinned'
32 alias bubc='brew upgrade && brew cleanup'
33 alias bubo='brew update && brew outdated'
34 alias bubu='bubo && bubc'
35 alias buf='brew upgrade --formula'
38 local formulae="$(brew leaves | xargs brew deps --installed --for-each)"
39 local casks="$(brew list --cask)"
41 local blue="$(tput setaf 4)"
42 local bold="$(tput bold)"
43 local off="$(tput sgr0)"
45 echo "${blue}==>${off} ${bold}Formulae${off}"
46 echo "${formulae}" | sed "s/^\(.*\):\(.*\)$/\1${blue}\2${off}/"
47 echo "\n${blue}==>${off} ${bold}Casks${off}\n${casks}"