Fix macOS PATH being rewritten in /etc/zprofile

macOS is obnoxious and overwrites the PATH from a users ~/.zshenv, which is
sourced first, in /etc/zprofile by calling `/usr/libexec/path_helper -s` so
this is required so that PATH is once again set to the desired value.
This commit is contained in:
2018-08-26 20:17:24 +01:00
parent e17ff47d5e
commit 0ab04406ec
3 changed files with 20 additions and 17 deletions

16
zshrc
View File

@@ -158,22 +158,6 @@ fi
# Load work related config
[ -f ~/.config/work/zshrc ] && source ~/.config/work/zshrc
# Remove duplicates from environment variables
typeset -U PATH
typeset -U MANPATH
typeset -U INFOPATH
# Add ccache symlink directory to start of PATH, this must be after
# `typeset -U PATH` because on macOS this reorders the list so ccache's
# symlinks will no longer be at the start of PATH rendering it unusable.
if [ `uname` = Darwin ]; then
[ -f /usr/local/bin/ccache ] && \
PATH=/usr/local/opt/ccache/libexec:$PATH
else
[ -f /usr/bin/ccache ] && \
PATH=/usr/lib/ccache:$PATH
fi
# Aliases
alias grep='grep --color=always'
which cmake &> /dev/null && \