# Login shells only.
#
# Homebrew belongs here rather than in .zshrc. .zprofile is read by login
# shells, which includes the one behind every terminal window and, importantly,
# is the only hook that also covers a plain "ssh host <command>" reliably
# enough to matter. Putting brew's PATH in .zshrc leaves it missing from
# anything non-interactive, which is how "ssh mac brew --version" came back
# empty and was mistaken for Homebrew being absent.
#
# Harmless on Linux: neither prefix exists there, so the loop does nothing.
for _brew in /opt/homebrew /usr/local; do
  if [[ -x "$_brew/bin/brew" ]]; then
    eval "$("$_brew/bin/brew" shellenv)"
    break
  fi
done
unset _brew
