mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2025-01-15 18:18:33 +01:00
fix(brew): do not source brew shellenv
if already on path (#11167)
This commit is contained in:
parent
34cd8fbd4a
commit
c7c0a8917b
@ -10,7 +10,10 @@ plugins=(... brew)
|
|||||||
|
|
||||||
## Shellenv
|
## Shellenv
|
||||||
|
|
||||||
This plugin also executes `brew shellenv` at plugin load to set up many useful variables, such as `HOMEBREW_PREFIX` or `HOMEBREW_REPOSITORY`.
|
If `brew` is not found in the PATH, this plugin will attempt to find it in common
|
||||||
|
locations, and execute `brew shellenv` to set the environment appropriately.
|
||||||
|
This plugin will also export `HOMEBREW_PREFIX="$(brew --prefix)"` if not previously
|
||||||
|
defined for convenience.
|
||||||
|
|
||||||
## Aliases
|
## Aliases
|
||||||
|
|
||||||
|
@ -10,18 +10,21 @@ if (( ! $+commands[brew] )); then
|
|||||||
else
|
else
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Only add Homebrew installation to PATH, MANPATH, and INFOPATH if brew is
|
||||||
|
# not already on the path, to prevent duplicate entries. This aligns with
|
||||||
|
# the behavior of the brew installer.sh post-install steps.
|
||||||
|
eval "$("$BREW_LOCATION" shellenv)"
|
||||||
|
unset BREW_LOCATION
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ -z "$HOMEBREW_PREFIX" ]]; then
|
if [[ -z "$HOMEBREW_PREFIX" ]]; then
|
||||||
if [[ -z $BREW_LOCATION ]]; then
|
# Maintain compatability with potential custom user profiles, where we had
|
||||||
eval "$(brew shellenv)"
|
# previously relied on always sourcing shellenv. OMZ plugins should not rely
|
||||||
else
|
# on this to be defined due to out of order processing.
|
||||||
eval "$("$BREW_LOCATION" shellenv)"
|
export HOMEBREW_PREFIX="$(brew --prefix)"
|
||||||
fi
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
unset BREW_LOCATION
|
|
||||||
|
|
||||||
alias bcubc='brew upgrade --cask && brew cleanup'
|
alias bcubc='brew upgrade --cask && brew cleanup'
|
||||||
alias bcubo='brew update && brew outdated --cask'
|
alias bcubo='brew update && brew outdated --cask'
|
||||||
alias brewp='brew pin'
|
alias brewp='brew pin'
|
||||||
|
Loading…
Reference in New Issue
Block a user