Detect OS X broken /etc/zshenv and suggest rename

If `/etc/zshenv` that calls `path_helper` is found on the system, assume
OS X version pre-El Capitan and suggest that this file gets renamed to
`zprofile` so that it only gets sourced on login shells and doesn't mess
up PATH order on nested invocation of zsh.
This commit is contained in:
Mislav Marohnić 2015-10-05 02:19:40 +02:00 committed by Geoff Harcourt
parent ed8619e0ab
commit 5d397e6fa5

13
zshrc
View file

@ -111,5 +111,18 @@ _load_settings() {
}
_load_settings "$HOME/.zsh/configs"
# detect old OS X broken /etc/zshenv and suggest rename
if grep -qw path_helper /etc/zshenv 2>/dev/null; then
cat <<MSG >&2
${fg[red]}Warning:${reset_color} \`/etc/zshenv' configuration file on your system may cause unexpected
PATH changes on subsequent invocations of the zsh shell. The solution is to
rename the file to \`zprofile':
${fg_bold[white]}sudo mv /etc/{zshenv,zprofile}${reset_color}
(called from ${(%):-%N:%i})
MSG
fi
# Local config
[[ -f ~/.zshrc.local ]] && source ~/.zshrc.local