I upgraded to El Capitan last week and noticed shortly thereafter that my path was messed up; when opening up new terminal windows, the active version of ruby was the system version instead of my RVM default. On investigating, I saw that for some reason the default paths in
/usr/local/bin:/usr/bin:…) were first in my path instead of last, as they would have been if my
.zshrc were being sourced properly. Here’s how I fixed it.
So the problem is that El Capitan creates an
/etc/zprofile that contains the following:
1 2 3 4 # system-wide environment settings for zsh(1) if [ -x /usr/libexec/path_helper ]; then eval `/usr/libexec/path_helper -s` fi
path_helper is a utility that adds those default paths to your path. Problem is that
/etc/zprofile gets sourced after
~/.zshenv (background), and if you construct your path in
.zshenv, like I was, this meant that all the hard work I was doing to build my path in the first file was getting screwed up by sourcing the second.
So I had two choices:
- Move all my path construction to
.zshrc, since they get sourced after
/etc/zprofile. This was a no-go since I want my path to work for non-login shells.
- Simply comment out the lines in
/etc/zprofile. Which is what I did.
And, boom! Back in business.