cmc/dotfiles

Using GNU Stow to manage my dotfiles.

clone: git clone https://gitbay.org/cmc/dotfiles.git

81137fa2d7a0710713d2afed1f2d1955cfd6cefa

verified · cmc

author: Christian Cleberg <hello@cleberg.net> · 2026-02-23T17:56:48Z

add option for local brew
 common/zsh/.zshrc | 19 ++++++++++++++++---
 1 file changed, 16 insertions(+), 3 deletions(-)

diff --git a/common/zsh/.zshrc b/common/zsh/.zshrc
index 07452f2..21304c8 100644
--- a/common/zsh/.zshrc
+++ b/common/zsh/.zshrc
@@ -2,15 +2,28 @@
 # 1. OS-SPECIFIC CONFIGURATION
 # ==============================================================================
 
-# Use uname to detect the OS and set the correct Homebrew path
 if [[ "$(uname)" == "Darwin" ]]; then
-  # macOS (Apple Silicon)
-  BREW_PREFIX="/opt/homebrew"
+  # macOS - Check for custom path first, then standard paths
+  if [ -d "$HOME/Documents/.brew" ]; then
+    # Custom installation path
+    BREW_PREFIX="$HOME/Documents/.brew"
+  elif [ -d "/opt/homebrew" ]; then
+    # Standard path for Apple Silicon Macs
+    BREW_PREFIX="/opt/homebrew"
+  else
+    # Standard path for Intel Macs
+    BREW_PREFIX="/usr/local"
+  fi
 elif [[ "$(uname)" == "Linux" ]]; then
   # Linux (Linuxbrew)
   BREW_PREFIX="/home/linuxbrew/.linuxbrew"
 fi
 
+# If a Homebrew installation was found, add it to the shell environment
+if [ -n "$BREW_PREFIX" ]; then
+  eval "$($BREW_PREFIX/bin/brew shellenv)"
+fi
+
 # ==============================================================================
 # 2. PRE-INITIALIZATION (Instant Prompt)
 # ==============================================================================