Self-importance. Entitlement. Snobbery.

Fixing your zsh path after upgrading to El Capitan.

Oct 8 2015

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 /etc/paths (/usr/local/bin:/usr/bin:…) were first in my path instead of last, as they would have been if my .zshenv and .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:

# system-wide environment settings for zsh(1)
if [ -x /usr/libexec/path_helper ]; then
   eval `/usr/libexec/path_helper -s`

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:

  1. Move all my path construction to .zprofile or .zshrc, since they get sourced after /etc/zprofile. This was a no-go since I want my path to work for non-login shells.
  2. Simply comment out the lines in /etc/zprofile. Which is what I did.

And, boom! Back in business.