diff --git a/zshenv b/zshenv index 4ca68bc..db90922 100644 --- a/zshenv +++ b/zshenv @@ -21,9 +21,6 @@ PATH=$HOME/.local/bin:$PATH MANPATH=$HOME/.local/share/man:$MANPATH INFOPATH=$HOME/.local/share/info:$INFOPATH -# Add ccache to the PATH if present -[ -f /usr/bin/ccache ] && PATH=/usr/lib/ccache:$PATH - # Use ~/.local for pip installs on macOS [ "`uname`" = "Darwin" ] && export PYTHONUSERBASE=$HOME/.local diff --git a/zshrc b/zshrc index 309d5d0..1cb269a 100644 --- a/zshrc +++ b/zshrc @@ -117,6 +117,17 @@ 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' alias cninja='cmake -GNinja -DCMAKE_EXPORT_COMPILE_COMMNADS=ON'