Skip to content

Instantly share code, notes, and snippets.

@MLKrisJohnson
Created November 8, 2023 15:37
Show Gist options
  • Save MLKrisJohnson/89fad4a8d34ba4444678cf12bc611f16 to your computer and use it in GitHub Desktop.
Save MLKrisJohnson/89fad4a8d34ba4444678cf12bc611f16 to your computer and use it in GitHub Desktop.
Homebrew shell setup for Intel and Apple silicon or Rosetta
# Init Homebrew shell environment
if [ "$(arch)" = 'i386' ]; then
[ -e /usr/local/bin/brew ] && eval "$(/usr/local/bin/brew shellenv)"
# Force use of Intel dotnet binaries
export PATH="/usr/local/share/dotnet/x64:$PATH"
echo 'Initialized i386 environment'
else # arch = arm64
[ -e /opt/homebrew/bin/brew ] && eval "$(/opt/homebrew/bin/brew shellenv)"
echo 'Initialized arm64 environment'
fi
# Init Homebrew packages if installed
if command -v brew >& /dev/null; then
# brew install nvm
export NVM_DIR="$HOME/.nvm"
[ -s "$(brew --prefix)/opt/nvm/nvm.sh" ] && . "$(brew --prefix)/opt/nvm/nvm.sh" # This loads nvm
[ -s "$(brew --prefix)/opt/nvm/etc/bash_completion.d/nvm" ] && . "$(brew --prefix)/opt/nvm/etc/bash_completion.d/nvm"
# brew install pyenv
if [ -e "$(brew --prefix)/bin/pyenv" ]; then
export PYENV_ROOT="$HOME/.pyenv"
export PATH="$PYENV_ROOT/bin:$PATH"
eval "$(pyenv init --path)"
eval "$(pyenv init -)"
fi
# brew install pyenv-virtualenv
if which pyenv-virtualenv-init > /dev/null; then eval "$(pyenv virtualenv-init -)"; fi
# brew install z
[ -e "$(brew --prefix)/etc/profile.d/z.sh" ] && . "$(brew --prefix)/etc/profile.d/z.sh"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment