1
votes

Just installed ruby 2.4.1 on my Mac (running sierra) using rbenv. I also installed ruby 2.4.0. Ruby Directories are present.

however, ruby -v gives

ruby 2.0.0p648 (2015-12-16 revision 53162) [universal.x86_64-darwin16]

even after setting "rbenv global 2.4.1" ...

Output from "gem env"

RubyGems Environment:
  - RUBYGEMS VERSION: 2.0.14.1
  - RUBY VERSION: 2.0.0 (2015-12-16 patchlevel 648) [universal.x86_64-darwin16]
  - INSTALLATION DIRECTORY: /Library/Ruby/Gems/2.0.0
  - RUBY EXECUTABLE: /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby
  - EXECUTABLE DIRECTORY: /usr/local/bin
  - RUBYGEMS PLATFORMS:
    - ruby
    - universal-darwin-16
  - GEM PATHS:
     - /Library/Ruby/Gems/2.0.0
     - /Users/marauf/.gem/ruby/2.0.0
     - /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/gems/2.0.0
  - GEM CONFIGURATION:
     - :update_sources => true
     - :verbose => true
     - :backtrace => false
     - :bulk_threshold => 1000
  - REMOTE SOURCES:
     - https://rubygems.org/

Output from "rbenv versions"

  system
  2.4.0
* 2.4.1 (set by /Users/me/.rbenv/version)

ruby-build updated, based on a few other posts.

I can't install latest Rails because it sees ruby 2.0.0 instead of ruby 2.4.1. Assistance Please!!

2

2 Answers

1
votes

rbenv global doesn't work the way you seem to think it does. global only sets the ruby version where not otherwise specified. So what other ways can the ruby version be set?

1) rbenv shell sets the version in use for the current shell session;

2) rbenv local sets the version for use in the current directory. You should see a .ruby_version file in your working directory dictating what version of ruby to use and overriding your rbenv global command.

You would know immediately if you were doing 1), so I'm betting that you set a ruby version in your project directory at some point, maybe without realizing it. You should be able to create and change to a new directory where your global version is respected.

Note: You may consider this a bit of editorializing, but if you're not totally wedded to rbenv, consider using rvm. rvm has a use command that sets the version of ruby in use on the fly, which is terribly convenient.

0
votes

Shoulda updated ... I totally forgot to update my .bashrc_profile with $PATH ... did that and worked well.

thankx for the comments.