Whenever I start a new shell, ruby points to the system version, not the version I installed with home-manager. However, when I run exec zsh, ruby points to the home-manager version.
I have this same problem with vim, where zsh uses the system version until I reload it. I suspect that this will be a problem for overriding any command that I already have installed.
I’m confused why this is happening, and I want to know how I can have zsh use the home-manager version automatically.
I’m always confusing regular, login, non-interactive, interactive, and whatnot modes of shells… So yeah, can totally be that I mean the opposite of what I am saying.
I dug a little deeper, and thought about what could be causing my original issue. Somehow, the commands installed through home-manager aren’t being added to my PATH, right? So I compared the PATHs before and after I reloaded the shell.
In the after picture, my custom paths are added to the beginning of PATH, so they take precedence over the default paths. But, this makes me confused, why are they added to the end of PATH in the before picture?
So my nix path is being added to PATH before my system path, and it gets re-ordered by path_helper. Renaming my .zshenv to .zprofile fixed this issue, but I’m still confused on why Apple sets the PATH variable in /etc/zprofile instead of /etc/zshenv.
Looks like abandoning .zshenv in favor of .zprofile is the recommended solution, based on this write-up.
I also considered renaming /etc/zprofile to /etc/zshenv, but after reading a related Nix issue, I don’t think that would have been a good solution; it probably would have lead to things breaking after an update.
I still couldn’t find anything about Apple not using /etc/zshenv, so if anyone finds anything on that, let me know.