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:
16
zshenv
16
zshenv
@@ -12,7 +12,7 @@ SAVEHIST=5000
|
||||
REPORTTIME=5
|
||||
|
||||
# Add Homebrew python to PATH on macOS if present
|
||||
[ "`uname`" = "Darwin" ] && [ -d /usr/local/opt/python/libexec/bin ] &&
|
||||
[ -d /usr/local/opt/python/libexec/bin ] && \
|
||||
PATH=/usr/local/opt/python/libexec/bin:$PATH
|
||||
|
||||
# Add ~/.local to the environment
|
||||
@@ -21,6 +21,20 @@ PATH=$HOME/.local/bin:$PATH
|
||||
MANPATH=$HOME/.local/share/man:$MANPATH
|
||||
INFOPATH=$HOME/.local/share/info:$INFOPATH
|
||||
|
||||
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
|
||||
|
||||
# Remove duplicates from environment variables
|
||||
typeset -U fpath
|
||||
typeset -U PATH; export PATH
|
||||
typeset -U MANPATH; export MANPATH
|
||||
typeset -U INFOPATH; export INFOPATH
|
||||
|
||||
# Use ~/.local for pip installs on macOS
|
||||
[ "`uname`" = "Darwin" ] && export PYTHONUSERBASE=$HOME/.local
|
||||
|
||||
|
||||
Reference in New Issue
Block a user