Skip to content

Instantly share code, notes, and snippets.

@jabenninghoff
Last active June 26, 2023 19:56
Show Gist options
  • Save jabenninghoff/7692a2bdc4007602638cd5bef1b8c0e9 to your computer and use it in GitHub Desktop.
Save jabenninghoff/7692a2bdc4007602638cd5bef1b8c0e9 to your computer and use it in GitHub Desktop.
Add homebrew to environment if installed (arm or intel)
# remove /usr/local/bin from /etc/paths
export PATH="$PATH:s/\/usr\/local\/bin://"
# add homebrew to environment
if [ -x /usr/local/bin/brew ]
then
eval "$(/usr/local/bin/brew shellenv)"
elif [ -x /opt/homebrew/bin/brew ]
then
export PATH="/usr/local/bin:/usr/local/sbin${PATH+:$PATH}"
eval "$(/opt/homebrew/bin/brew shellenv)"
else
export PATH="/usr/local/bin:/usr/local/sbin${PATH+:$PATH}"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment