Skip to content

Commit

Permalink
feat: Update zsh configs to support multiple Homebrew installations
Browse files Browse the repository at this point in the history
feat #1: Update .zshenv to support multiple Homebrew installations

Added conditional checks in .zshenv to evaluate the Homebrew environment
based on the existence of the Homebrew binary in either the /opt/homebrew
or /usr/local/bin directories. This ensures compatibility with different
Homebrew installations.

feat #2: Improve Antigen sourcing logic in .zshrc

Updated the .zshrc configuration to include conditional sourcing for Antigen.
Checks for the existence of Antigen in two possible locations and provides
a message if not found, enhancing user experience and installation guidance.
  • Loading branch information
ylogx committed Feb 17, 2025
1 parent 7a41279 commit 5891a55
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
6 changes: 5 additions & 1 deletion home/.zshenv
Original file line number Diff line number Diff line change
@@ -1 +1,5 @@
eval "$(/opt/homebrew/bin/brew shellenv)"
if [ -x "/opt/homebrew/bin/brew" ]; then
eval "$(/opt/homebrew/bin/brew shellenv)"
elif [ -x "/usr/local/bin/brew" ]; then
eval "$(/usr/local/bin/brew shellenv)"
fi
11 changes: 8 additions & 3 deletions home/.zshrc
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,14 @@ ZSH_HIGHLIGHT_HIGHLIGHTERS=(main brackets pattern cursor)
###############
### Antigen ###
###############
#source ~/bin/antigen.zsh
#source /usr/local/share/antigen/antigen.zsh # brew install antigen
source /opt/homebrew/share/antigen/antigen.zsh
#brew install antigen
if [ -f "/opt/homebrew/share/antigen/antigen.zsh" ]; then
source /opt/homebrew/share/antigen/antigen.zsh
elif [ -f "/usr/local/share/antigen/antigen.zsh" ]; then
source /usr/local/share/antigen/antigen.zsh
else
echo "Antigen not found. Please install antigen using: brew install antigen"
fi

# Load the oh-my-zsh's library.
antigen use oh-my-zsh
Expand Down

0 comments on commit 5891a55

Please sign in to comment.