From 2bbf5d0687bf754fff8ab6fcaec70669907aa29b Mon Sep 17 00:00:00 2001 From: Indrajit Raychaudhuri Date: Fri, 14 Sep 2018 23:40:08 -0500 Subject: [PATCH] homebrew: Load standard Homebrew environment variables into shell session. However, guard for legacy Homebrew as `brew shellenv` is relatively new. --- modules/homebrew/README.md | 11 ++++++++++- modules/homebrew/init.zsh | 10 ++++++++++ 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/modules/homebrew/README.md b/modules/homebrew/README.md index 98a3444..1a6df51 100644 --- a/modules/homebrew/README.md +++ b/modules/homebrew/README.md @@ -1,7 +1,16 @@ Homebrew ======== -Defines Homebrew aliases. +Defines Homebrew specific shell environment variables and aliases. + +Environment Variables +--------------------- + +Execute the following to list the environment variables loaded in the shell: + +```sh +brew shellenv +``` Aliases ------- diff --git a/modules/homebrew/init.zsh b/modules/homebrew/init.zsh index e517c0a..12acf59 100644 --- a/modules/homebrew/init.zsh +++ b/modules/homebrew/init.zsh @@ -10,6 +10,16 @@ if [[ "$OSTYPE" != (darwin|linux)* ]]; then return 1 fi +# +# Environmental Variables +# + +# Load standard Homebrew shellenv into the shell session. +# `brew shellenv` is relatively new, guard for legacy Homebrew. +if (( $+commands[brew] )); then + eval "$(brew shellenv 2> /dev/null)" +fi + # # Aliases #