0

Hi there ive been searching for a fix on stackexchange and google for a long time and without success, so i thought id give up and ask this question since it seems to have not been covered on other topics.

Im having the following message appear when i try to initiate a rails server (which did work before, i just dont know how i broke it)

Your Ruby version is 2.0.0, but your Gemfile specified 2.2.3

A bit of context: im on OSX, with rbenv installed via homebrew.

$ rbenv versions system * 2.2.3 (set by /Users/<user>/.rbenv/version)

ok, so rbenv is installed and has the right version.

echo $PATH /Users/<user>/.rbenv/shims:/Users/<user>/.rbenv/bin:/usr/local/sbin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin :

$PATH is there and i have the following on ~./bash_profile export PATH="$HOME/.rbenv/bin:$PATH" if which rbenv > /dev/null; then eval "$(rbenv init -)"; fi

ok so whats the problem? you ask? because i have the following thrown back at me:

$ ruby -v ruby 2.0.0p648 (2015-12-16 revision 53162) [universal.x86_64-darwin15] $ which ruby /usr/bin/ruby

now, this last bit have me hope, it seems im using OSX's built in ruby and not the one from rbenvso i did a gem env

RubyGems Environment: - RUBYGEMS VERSION: 2.6.3 - RUBY VERSION: 2.0.0 (2015-12-16 patchlevel 648) [universal.x86_64-darwin15] - INSTALLATION DIRECTORY: /Library/Ruby/Gems/2.0.0 - USER INSTALLATION DIRECTORY: /Users/<user>/.gem/ruby/2.0.0 - RUBY EXECUTABLE: /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby - EXECUTABLE DIRECTORY: /usr/bin - SPEC CACHE DIRECTORY: /Users/<user>/.gem/specs - SYSTEM CONFIGURATION DIRECTORY: /Library/Ruby/Site - GEM PATHS: - /Library/Ruby/Gems/2.0.0 - /Users/bronze/.gem/ruby/2.0.0 - /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/gems/2.0.0 - SHELL PATH: - /Users/<user>/.rbenv/bin - /Users/<user>/.rbenv/shims - /Users/<user>/.rbenv/bin - /usr/local/sbin - /usr/local/bin - /usr/bin - /bin - /usr/sbin - /sbin

i have found no paths i could take at this point. for me it seems all is installed but OSX doesnt see the shims or whatever from rbenv

$ which -a ruby /usr/bin/ruby

this should have showed the rbenv installation, right?

any and all help is much appreciated at this time.

-cheers

bronze
  • 79
  • 7

4 Answers4

0

Please run rbenv init per the instructions.

hd1
  • 33,938
  • 5
  • 80
  • 91
  • i did. `rbenv init` and `rbenv rehash`, init gives me ```rbenv init # Load rbenv automatically by appending # the following to ~/.bash_profile: eval "$(rbenv init -)"``` – bronze Apr 24 '16 at 00:05
  • yes, ive seen a couple ways of adding it but this is what i got ```### There from beginning export PATH="/usr/local/bin:$PATH" ### Added by Homebrew export PATH="/usr/local/sbin:$PATH" #Rbenv adding export PATH="$HOME/.rbenv/bin:$PATH" if which rbenv > /dev/null; then eval "$(rbenv init -)"; fi eval "$(rbenv init -)"``` – bronze Apr 24 '16 at 00:44
  • link to a gist better formatted with .bash_profile https://gist.github.com/bronze/1f5395b27bd5974a91811a2d4fea9744 – bronze Apr 24 '16 at 00:46
  • update: uninstalled homebrew and rbenv and reinstalled from scratch, now it finds ruby ```which -a ruby /Users//.rbenv/shims/ruby /usr/bin/ruby``` but `gem env` still doesnt see the rbenv dir – bronze Apr 24 '16 at 01:13
0

Ok this has been a wild trip so if anyone finds this question in the future, this is what worked: uninstall everything

brew uninstall rbenv brew uninstall ruby-build rm -rf `brew --prefix`/Cellar/rbenv as per How do you uninstall rbenv on OSX?

then i also uninstalled homebrew. a bit drastic but nothing was working anyway...

so, starting from scratch, installing homebrew, then rbenv, then the right version, and the shims path started appearing.

Community
  • 1
  • 1
bronze
  • 79
  • 7
0

RVM gives you gemsets, which are sandboxed environments that let you maintain separate sets of gems.

$ rvm gemset use global this should return:

gemsets for ruby-2.x.x => (default) global

$ rvm gemset use global
$ gem list

done!

Amed Kino
  • 36
  • 2
0

Have you set your global or local version with rbenv? rbenv global 2.2.3

By using the global every project will have ruby 2.2.3 available.
If you want to only use this version in the current folder: rbenv local 2.2.3

Renews
  • 614
  • 5
  • 17