Search code examples
ruby-on-railsrubylinuxbundlerosx-mavericks

Mavericks, RBENV, Your Ruby version is 2.0.0, but your Gemfile specified 2.1.1


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. That leads me to think my issue is something corrupt with a piece of Ruby/RBENV ecosystem on my computer or maybe a dreaded PATH issue. I always have to run sudo to install any gems, which I've never had to do before, so that's puzzling too.

Here are some outputs of files & commands I think are relevant. If you need more information, please let me know:

.zshrc

export PATH="/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin" if which rbenv > /dev/null;
then eval "$(rbenv init - zsh)"; fi

ruby -v

ruby 2.1.1p76 (2014-02-24 revision 45161) [x86_64-darwin13.0]

rbenv local

2.1.1

Gemfile (I've also blown out my gemfile.lock several times too)

source 'https://rubygems.org'

ruby '2.1.1'

gem 'rails', '4.1.4'
... [omitted for brevity]

.ruby-version

2.1.1

echo $PATH

/[user path]/.rbenv/shims:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin

I'd be grateful if anyone has any ideas about what I should try next, short of reformatting my computer.

EDIT 1: Tried option B installing both of them from their git repos below as per Ben Kreeger. type rbenv correctly returned rbenv is a shell function and the original message kept appearing. I reinstalled Mavericks and my setup still isn't working.

EDIT 2: Any time I try to install a gem, I get a Gem::FilePermissionError saying I don't have access to the Ruby 2.0.0 folder (installed as system). Going to fiddle with RBENV some more...

EDIT 3: More debugging (everything below)

Kept erroring when installing Ruby versions with RBENV and found some people mentioning readline issues.

Tried the following steps to fix readline: https://github.com/sstephenson/ruby-build/issues/550#issuecomment-40681557, and got an error that my Xcode command line tool install was bad.

Ran xcode-select --install to reinstall them.

Tried rbenv install 2.1.1 again, and got The Ruby openssl extension was not compiled. Missing the OpenSSL lib?

As per https://coderwall.com/p/n9bnug, I linked my OpenSSL extension with https://coderwall.com/p/n9bnug

Reset versions of Ruby: rbenv local 2.1.1 rbenv global 2.1.1 and rbenv rehash

Everything seems to indicate bundler is trying to use my system Ruby install (2.0.0-p247) instead of what RBENV is specifying. Baffled where the missing link is.


Solution

  • 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?