fix(shell): guard brew shellenv against TCC and keep eza aliases

.zshenv runs brew shellenv for every zsh, including non-interactive and
GUI-launched shells; without a safe CWD the eval fails or triggers a
permission prompt when launched from a TCC-protected directory such as
~/Documents. Run it from /tmp.

The eza `l` alias (and the myip/e/ip/a/aa group) was defined before
oh-my-zsh loaded, so lib/directories.zsh overrode `l` back to ls. Move
the alias block after the oh-my-zsh source so the eza versions win.

Also document the ~/.config/zshrc personal-config mechanism and patch.sh
in the README, which previously only had a title.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Yuhao Qing
2026-08-03 02:22:18 +08:00
co-authored by Cursor
parent 9377023e28
commit 12108ca3e4
3 changed files with 58 additions and 11 deletions
+5 -2
View File
@@ -1,5 +1,8 @@
# Homebrew on macOS. .zshenv runs for every zsh (interactive, scripts, GUI-launched),
# and brew shellenv needs a readable CWD: cd to a safe dir first so launching from a
# TCC-protected directory (e.g. ~/Documents) does not break the eval or prompt for access.
if [ -x /opt/homebrew/bin/brew ]; then
eval "$(/opt/homebrew/bin/brew shellenv)"
eval "$(cd /tmp && /opt/homebrew/bin/brew shellenv)"
elif [ -x /usr/local/bin/brew ]; then
eval "$(/usr/local/bin/brew shellenv)"
eval "$(cd /tmp && /usr/local/bin/brew shellenv)"
fi