0

I'm having a bit of trouble getting Ruby properly upgraded to 2.3.0 on my macbook. I followed the instructions here: https://gorails.com/setup/osx/10.11-el-capitan

However, I still can't install chef-zero (which is the reason I had to upgrade), and my Gem "classpath" still seems to be pointing at the old Ruby version:

amencke@offplantever-lm ~/d/chef-repo> rbenv local
2.3.0
amencke@offplantever-lm ~/d/chef-repo> rbenv global
2.3.0
amencke@offplantever-lm ~/d/chef-repo> ruby -v
ruby 2.3.0p0 (2015-12-25 revision 53290) [x86_64-darwin14]

Seems OK so far...

amencke@offplantever-lm ~/d/chef-repo> gem environment
RubyGems Environment:
  - RUBYGEMS VERSION: 2.3.0
  - RUBY VERSION: 2.0.0 (2014-05-08 patchlevel 481) [universal.x86_64-darwin14]
  - INSTALLATION DIRECTORY: /Library/Ruby/Gems/2.0.0
  - RUBY EXECUTABLE: /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby
  - EXECUTABLE DIRECTORY: /usr/bin
  - SPEC CACHE DIRECTORY: /Users/amencke/.gem/specs
  - SYSTEM CONFIGURATION DIRECTORY: /Library/Ruby/Site
  - RUBYGEMS PLATFORMS:
    - ruby
    - universal-darwin-14
  - GEM PATHS:
     - /Library/Ruby/Gems/2.0.0
     - /Users/amencke/.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/
  - SHELL PATH:
     - /usr/local/bin
     - /usr/bin
     - /bin
     - /usr/sbin
     - /sbin
amencke@offplantever-lm ~/d/chef-repo> 

And if I try to install chef-zero:

amencke@offplantever-lm ~/d/chef-repo> sudo gem install chef-zero 
Password:
ERROR:  Error installing chef-zero:
    chef-zero requires Ruby version >= 2.1.0.
amencke@offplantever-lm ~/d/chef-repo> 

Any ideas? I'm not particularly experienced with Ruby at all (or creating dev environments on OSX) - a point in the right direction would be much appreciated!

Arthur M
  • 447
  • 5
  • 21
  • 1
    I found via this link http://stackoverflow.com/questions/10940736/rbenv-not-changing-ruby-version that checklist for correct rbenv setup https://github.com/rbenv/rbenv/wiki#how-to-verify-that-i-have-set-up-rbenv-correctly with the suggestion to try out number 2. Curious if it's that. – trueunlessfalse Apr 25 '16 at 17:54
  • 1
    or setup `rvm` to manage the packages, because installation gem into root env is ugly way. issue `whcih gem` from projects folder – Малъ Скрылевъ Apr 25 '16 at 18:18
  • @trueunlessfalse - that link lead me to a resolution. I will update the question with the steps. Thanks to both for the input - I will look into setting up a virtual environment – Arthur M Apr 25 '16 at 18:32
  • Please do NOT put solutions in the question. Stack Overflow is a Question/Answer format, and answers are significant. Please remove the "answer" from and create a separate answer, pasting the information there. Then, when Stack Overflow allows, you can select the answer as the solution. Failing to do this only confuses the system. – the Tin Man Apr 25 '16 at 21:26

1 Answers1

0

The answer here was that I was using the fish shell. Coming from a linux backgroup I had been hurriedly updating environment settings is ~/.bash_profile. Those settings have been explained here: rbenv not changing ruby version. Since I don't really like fish anyway, it was no issue to simply change back to bash using chsh -s /bin/bash and hey presto:

offplantever-lm:~ amencke$ gem env
RubyGems Environment:
  - RUBYGEMS VERSION: 2.5.1
  - RUBY VERSION: 2.3.0 (2015-12-25 patchlevel 0) [x86_64-darwin14]
  - INSTALLATION DIRECTORY: /Users/amencke/.rvm/gems/ruby-2.3.0
  - USER INSTALLATION DIRECTORY: /Users/amencke/.gem/ruby/2.3.0
  - RUBY EXECUTABLE: /Users/amencke/.rbenv/versions/2.3.0/bin/ruby
  - EXECUTABLE DIRECTORY: /Users/amencke/.rvm/gems/ruby-2.3.0/bin
  - SPEC CACHE DIRECTORY: /Users/amencke/.gem/specs
  - SYSTEM CONFIGURATION DIRECTORY: /Users/amencke/.rbenv/versions/2.3.0/etc
  - RUBYGEMS PLATFORMS:
    - ruby
    - x86_64-darwin-14
  - GEM PATHS:
     - /Users/amencke/.rvm/gems/ruby-2.3.0
     - /Users/amencke/.rvm/gems/ruby-2.3.0@global
     - ... 

Cheers, Arthur

Community
  • 1
  • 1
Arthur M
  • 447
  • 5
  • 21