I just compiled Ruby from source and it is located into /usr/local/ruby
In order to access Ruby's executables I edited ~/.zshenv adding /usr/local/ruby/bin to the export PATH directive:
export PATH=/usr/local/ruby/bin:/usr/local/mysql/bin:/usr/local/sbin:/usr/local/bin:$PATH
^^^^^^^^^^^^^^^^^^^^
However restarting the terminal and running which ruby still returns macOS's default /usr/bin/ruby
In fact inspecting PATH reveals:
% echo $PATH
/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/Apple/usr/bin:/usr/local/ruby/bin:/usr/local/mysql/bin:/usr/local/sbin:
So after my ~/.zshenv is excecuted another configuration file prepends /usr/bin to PATH.
Where does this happen?
I would expect to find /usr/bin already in PATH when .zshenv is processed (resulting in having this path at the end of the environment variable).
What I am missing?
I checked and there are no other zsh configuration files in my home directory, just .zshenv;
I checked /etc too and found
zprofile
zshrc
zshrc_Apple_Terminal
but none of those do alter the PATH variable
on /etc/paths
I have
/usr/local/bin
/usr/bin
/bin
/usr/sbin
/sbin
but again, shouldn't be PATH already set with those paths when .zshenv is processed ?