I\'ve read and tried the suggestions in several, other, questions, like mine (all with accepted answers) as well as a few more hours of Google searching, but nothing worked.
If you're having to use sudo
to install gems, then something's likely wrong with your rbenv installation. I'm of the opinion that if you're on OS X and you have to run sudo
to install gems or packages, you're doing it wrong (especially if you've got homebrew
installed)! You've got two options —
Option A: Alter your .zshrc
to be a little more friendly with your $PATH
and your rbenv settings. Note here that /usr/local/bin
is just being prepended to $PATH
, which itself is going to set to a proper default by your system (Mavericks). Make those two lines you posted look like this:
export PATH="/usr/local/bin:$PATH"
eval "$(rbenv init -)"
Then ensure that you close any and all shells and open new ones to load the new settings. Then when you run echo $PATH
it should look similar to...
[home path]/.rbenv/shims:[home path]/.rbenv/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin
Option B: Since I'm more familiar with installing rbenv via git, you may try nuking your homebrew-installed rbenv installation by brew remove rbenv
, and follow the directions specified on rbenv's github page (and don't forget to install ruby-build as well). This includes removing any rbenv-specific lines in your .zshrc
and setting them to what rbenv recommends.
You can always check the sanity of your rbenv installation by running type rbenv
at a command prompt. If all is well, you should at least be getting back "rbenv is a function"
.
WOW, JUST WOW.
All I had to do was gem install bundler
and then rbenv rehash
. Everything worked.
The original error message pointed me to a problem with RBENV or my Ruby version when in reality it was just falling back on an old version of bundler.
Why wouldn't I have received the more standard this needs bundler version [xxxx]...
error instead of telling me my Ruby version is specified incorrectly?