thoughtbot/dotfiles — pull request #305 by croaky (2014-09-30 22:41:40+00:00)
Title: Load rbenv in zshrc, not zshenv

On Mac OS X, there is a bug where `/etc/zshenv`'s `path_helper` forces
`/usr/bin` to the front of the `$PATH`:

https://github.com/sstephenson/rbenv/issues/369

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

This breaks rbenv by always using the system Ruby.

We have fixed this in the past in our Laptop script by moving `/etc/zshenv` to
`/etc/zprofile`:

https://github.com/thoughtbot/laptop/commit/c64806ec7d5e5111980152fa5a88922450873de3

And more recently, to `/etc/zshrc`:

https://github.com/thoughtbot/laptop/blame/master/mac

On Yosemite with the version of thoughtbot/dotfiles before this commit, with
rbenv being initialized in `~/.zshenv`, the problem returned.

Moving rbenv initialization back to `~/.zshrc` fixed the problem.

The official documentation for rbenv also recommends initializing in
`~/.zshrc`.

https://github.com/sstephenson/rbenv#basic-github-checkout

It also recommends:

export PATH="$HOME/.rbenv/bin:$PATH"