Allow Homebrew path detection under arm64e

This commit is contained in:
Spotlight 2020-11-25 00:08:53 -06:00
parent cbba7ae456
commit 041f800f96
Signed by: spotlight
GPG key ID: 874AA355B3209BDC
2 changed files with 35 additions and 26 deletions

47
zshrc
View file

@ -57,21 +57,17 @@ if [ -d ${HOME}/bin/android-sdk ]; then
export PATH="${HOME}/bin/android-sdk/platform-tools:${PATH}" export PATH="${HOME}/bin/android-sdk/platform-tools:${PATH}"
fi fi
# Google Cloud tools
if [ -d ${HOME}/bin/google-cloud-sdk ]; then
source ${HOME}/bin/google-cloud-sdk/path.zsh.inc
fi
# iTerm2 integration, only if detected as installed
test -e "${HOME}/.iterm2_shell_integration.zsh" && source "${HOME}/.iterm2_shell_integration.zsh"
# Go # Go
if [ -d ${HOME}/go ]; then
export GOPATH=${HOME}/go export GOPATH=${HOME}/go
export PATH=${GOPATH}/bin:${PATH} export PATH=${GOPATH}/bin:${PATH}
fi
# theos # theos
if [ -d ${HOME}/.theos ]; then
export THEOS=${HOME}/.theos export THEOS=${HOME}/.theos
export PATH=${THEOS}/bin:$PATH export PATH=${THEOS}/bin:$PATH
fi
# devkitPro and the like # devkitPro and the like
if [ -d /opt/devkitpro ]; then if [ -d /opt/devkitpro ]; then
@ -81,19 +77,31 @@ if [ -d /opt/devkitpro ]; then
export PATH=/opt/devkitpro/tools/bin:$PATH export PATH=/opt/devkitpro/tools/bin:$PATH
fi fi
if [ $TILIX_ID ] || [ $VTE_VERSION ]; then if [[ $OSTYPE == darwin* ]]; then
if [ -s /etc/profile.d/vte.sh ]; then # Under x86_64, we assume brew is in /usr/local.
source /etc/profile.d/vte.sh # However, under arm64e, it may be under /opt/homebrew.
elif [ -s /etc/profile.d/vte-2.91.sh ]; then # Alternatively, the user may not have Homebrew installed
source /etc/profile.d/vte-2.91.sh # whatsoever, in which nothing needs to be done.
fi # (By user, I mean me, and the occasional VM.)
if [ -f /usr/local/bin/brew ]; then
BREW_PREFIX="/usr/local"
BREW_FOUND=true
elif [ -f /opt/homebrew/bin/brew ]; then
BREW_PREFIX="/opt/homebrew"
BREW_FOUND=true
else
BREW_FOUND=false
fi fi
if [[ $OSTYPE == darwin* ]]; then if $BREW_FOUND; then
# Fix Homebrew pathing. # Ensure Homebrew can be found within the path.
export PATH="/usr/local/bin:/usr/local/sbin:${PATH}" export PATH="${BREW_PREFIX}/bin:${BREW_PREFIX}/sbin:${PATH}"
# Fix ZSH site-functions pathing due to Homebrew. fi
FPATH=$(brew --prefix)/share/zsh/site-functions:$FPATH
# Under Darwin, we also want iTerm2 integration if possible.
if [ -f ${HOME}/.iterm2_shell_integration.zsh ]; then
source "${HOME}/.iterm2_shell_integration.zsh"
fi
fi fi
# Personal preferences # Personal preferences
@ -127,5 +135,6 @@ compinit
# Google Cloud tries to prematurely call compinit for completion. # Google Cloud tries to prematurely call compinit for completion.
# I don't want >1 second load times. # I don't want >1 second load times.
if [ -d ${HOME}/bin/google-cloud-sdk ]; then if [ -d ${HOME}/bin/google-cloud-sdk ]; then
source ${HOME}/bin/google-cloud-sdk/path.zsh.inc
source ${HOME}/bin/google-cloud-sdk/completion.zsh.inc source ${HOME}/bin/google-cloud-sdk/completion.zsh.inc
fi fi