How to set correct Ruby version in gem environment - ruby

Note: This question relates to How can I get bundler to use the Ruby version set by chruby and .ruby-version?.
Using chruby I have Ruby 1.8.7 installed on macOS:
$ ruby -v
ruby 1.8.7 (2013-06-27 patchlevel 374) [i686-darwin17.4.0]
Also, I have used gem update --system 1.8.30 to install a specific version of RubyGems which I am hoping is compatible. This would appear to be installed properly:
$ gem --version
1.8.30
However, my RubyGems environment shows the incorrect version of Ruby (2.5.0):
$ gem env
RubyGems Environment:
- RUBYGEMS VERSION: 1.8.30
- RUBY VERSION: 2.5.0 (2017-12-25 patchlevel 0) [x86_64-darwin17]
- INSTALLATION DIRECTORY: /Users/keithpitty/.gem/ruby/1.8.7
- RUBY EXECUTABLE: /usr/local/opt/ruby/bin/ruby
- EXECUTABLE DIRECTORY: /Users/keithpitty/.gem/ruby/1.8.7/bin
- RUBYGEMS PLATFORMS:
- ruby
- x86_64-darwin-17
- GEM PATHS:
- /Users/keithpitty/.gem/ruby/1.8.7
- GEM CONFIGURATION:
- :update_sources => true
- :verbose => true
- :benchmark => false
- :backtrace => false
- :bulk_threshold => 1000
- REMOTE SOURCES:
- http://rubygems.org/
How can I fix the RubyGems environment to use the version of Ruby that chruby has set?

My missing step was installing RubyGems 1.6.2 from source. Following advice elsewhere from Dan Cheail, I did the following:
curl -O https://rubygems.org/rubygems/rubygems-1.6.2.tgz
(and then unzipped it)
cd rubygems-1.6.2
chruby ruby-1.8.7-p374
ruby setup.rb
gem update --system 1.8.25
And then my RubyGems environment was fixed:
$ gem env
RubyGems Environment:
- RUBYGEMS VERSION: 1.8.25
- RUBY VERSION: 1.8.7 (2013-06-27 patchlevel 374) [i686-darwin17.4.0]
- INSTALLATION DIRECTORY: /Users/keithpitty/.gem/ruby/1.8.7
- RUBY EXECUTABLE: /Users/keithpitty/.rubies/ruby-1.8.7-p374/bin/ruby
- EXECUTABLE DIRECTORY: /Users/keithpitty/.gem/ruby/1.8.7/bin
- RUBYGEMS PLATFORMS:
- ruby
- x86-darwin-17
- GEM PATHS:
- /Users/keithpitty/.gem/ruby/1.8.7
- /Users/keithpitty/.rubies/ruby-1.8.7-p374/lib/ruby/gems/1.8
- GEM CONFIGURATION:
- :update_sources => true
- :verbose => true
- :benchmark => false
- :backtrace => false
- :bulk_threshold => 1000
- REMOTE SOURCES:
- http://rubygems.org/

Related

how i can correct this error in ruby installed ruby is 1.9.3 and it shows the path of installed ruby 2.0.0

what is that probem and how can i solve it
RubyGems Environment:
- RUBYGEMS VERSION: 1.8.23
- RUBY VERSION: 1.9.3 (2013-05-15 patchlevel 429) [x86_64-linux]
- INSTALLATION DIRECTORY: /home8/novapext/.rvm/gems/ruby-2.0.0-p648
- RUBY EXECUTABLE: /usr/bin/ruby
- EXECUTABLE DIRECTORY: /home8/novapext/.rvm/gems/ruby-2.0.0-p648/bin
- RUBYGEMS PLATFORMS:
- ruby
- x86_64-linux
- GEM PATHS:
- /home8/novapext/.rvm/gems/ruby-2.0.0-p648
- /home8/novapext/.rvm/gems/ruby-2.0.0-p648:/home8/novapext/.rvm/gems /ruby-2.0.0-p648#global
- GEM CONFIGURATION:
- :update_sources => true
- :verbose => true
- :benchmark => false
- :backtrace => false
- :bulk_threshold => 1000
- "gem" => "--remote --gen-rdoc --run-tests"
- "gemhome" => "/home8/novapext/.rvm/gems/ruby-2.0.0-p648"
- "gempath" => "/home8/novapext/.rvm/gems/ruby-2.0.0-p648:/home8/novapext/.rvm/gems/ruby-2.0.0-p648#global"
- "rdoc" => "--inline-source --line-numbers"
- REMOTE SOURCES:
- http://rubygems.org/
this is therubygem environment how i can correct this it showing the ruby version 1.9.3 and installation directory is /home8/novapext/.rvm/gems/ruby-2.0.0-p648 this is my error
You could switch your rvm environment to ruby 1.9.3
rvm install 1.9.3
rvm use 1.9.3

How to set RUBY EXECUTABLE in .gemrc

My ~.gemrc looks like:
gem: --user-install --no-ri --no-rdoc
gemhome: /home/me/.gems
gempath:
- /home/me/.gems
and gem env returns:
RubyGems Environment:
- RUBYGEMS VERSION: 1.8.23.2
- RUBY VERSION: 1.9.3 (2014-05-14 patchlevel 547) [x86_64-linux]
- INSTALLATION DIRECTORY: /home/me/.gems
- RUBY EXECUTABLE: /usr/local/bin/ruby
- EXECUTABLE DIRECTORY: /home/me/.gems/bin
- RUBYGEMS PLATFORMS:
- ruby
- x86_64-linux
- GEM PATHS:
- /home/me/.gems
- GEM CONFIGURATION:
- :update_sources => true
- :verbose => true
- :benchmark => false
- :backtrace => false
- :bulk_threshold => 1000
- "gem" => "--user-install --no-ri --no-rdoc"
- "gemhome" => "/home/me/.gems"
- "gempath" => ["/home/me/.gems"]
- REMOTE SOURCES:
- http://rubygems.org/
My $PATH is
/home/me/ruby:/home/me/ruby/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games
and which ruby returns /home/slackbot/ruby/ruby.
Moreover when I install any gem like gem install bundler it goes to
.gem/ruby/1.9.1/bin/bundle
regardless my 1.9.3 version.
What am I doing wrong to set it up?

How to update gems in Ruby for Windows?

I'm using Ruby's Command prompt. I cannot install any update, but internet navigation seems to be working.
I have no proxy here.
C:\Windows\System32>gem update activesupport
Updating installed gems
ERROR: While executing gem ... (Gem::RemoteFetcher::FetchError)
SocketError: getaddrinfo: No such host is known. (http://rubygems.org/latest_specs.4.8.gz)
What could be wrong?
Here is my environment:
C:\Ruby\bin>gem env
RubyGems Environment:
- RUBYGEMS VERSION: 1.6.2
- RUBY VERSION: 1.9.2 (2011-02-18 patchlevel 180) [i386-mingw32]
- INSTALLATION DIRECTORY: C:/Ruby/lib/ruby/gems/1.9.1
- RUBY EXECUTABLE: C:/Ruby/bin/ruby.exe
- EXECUTABLE DIRECTORY: C:/Ruby/bin
- RUBYGEMS PLATFORMS:
- ruby
- x86-mingw32
- GEM PATHS:
- C:/Ruby/lib/ruby/gems/1.9.1
- C:/Users/wmj/.gem/ruby/1.9.1
- GEM CONFIGURATION:
- :update_sources => true
- :verbose => true
- :benchmark => false
- :backtrace => false
- :bulk_threshold => 1000
- REMOTE SOURCES:
- http://rubygems.org/
First run (with administrator privileges):
gem update --system
Then run the update for activesupport.
I have that error one time, because i was behind a proxy, in that case, put:
gem update --http-proxy http://web.proxy.uri --system

ruby version and gem's ruby version do not match

RubyGems is reporting a different ruby version than running ruby --version. Looking for suggestions on diagnosing and fixing this. OS is OS X 10.5.
lando-macbook:rubygems-1.3.7 lando$ gem env
RubyGems Environment:
- RUBYGEMS VERSION: 1.3.7
- RUBY VERSION: 1.8.6 (2009-06-08 patchlevel 369) [universal-darwin9.0]
- INSTALLATION DIRECTORY: /Library/Ruby/Gems/1.8
- RUBY EXECUTABLE: /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby
- EXECUTABLE DIRECTORY: /usr/bin
- RUBYGEMS PLATFORMS:
- ruby
- universal-darwin-9
- GEM PATHS:
- /Library/Ruby/Gems/1.8
- /Users/lkuhn/.gem/ruby/1.8
- /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8
- GEM CONFIGURATION:
- :update_sources => true
- :verbose => true
- :benchmark => false
- :backtrace => false
- :bulk_threshold => 1000
- REMOTE SOURCES:
- http://rubygems.org/
lando-macbook:rubygems-1.3.7 lando$ ruby --version
ruby 1.8.7 (2010-08-16 patchlevel 302) [i686-darwin9]
lando-macbook:rubygems-1.3.7 lando$ which ruby
/opt/local/bin/ruby
The problem is that you have a ruby executable in /opt/local/bin that was probably installed by macports at some point. Either deleting this ruby executable or removing /opt/local/bin from your PATH variable should solve your problem. gems is telling you exactly where it expects to find ruby and its associated executables:
RUBY EXECUTABLE: /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby
- EXECUTABLE DIRECTORY: /usr/bin

How can I install Jekyll on Ubuntu 10.04 Server?

The definitive guide to installing Jekyll seems to be https://github.com/jekyll/jekyll where it says:
gem install jekyll
I am getting an
ERROR: could not find gem jekyll locally or in a repository
regardless of whether I run that command as superuser or not.
gem env Returns the following:
RubyGems Environment:
- RUBYGEMS VERSION: 1.2.0
- RUBY VERSION: 1.8.7 (2008-08-11 patchlevel 72) [i486-linux]
- INSTALLATION DIRECTORY: /var/lib/gems/1.8
- RUBY EXECUTABLE: /usr/bin/ruby1.8
- EXECUTABLE DIRECTORY: /var/lib/gems/1.8/bin
- RUBYGEMS PLATFORMS:
- ruby
- x86-linux
- GEM PATHS:
- /var/lib/gems/1.8
- GEM CONFIGURATION:
- :update_sources => true
- :verbose => true
- :benchmark => false
- :backtrace => false
- :bulk_threshold => 1000
- :sources => ["http://gems.github.com/", "http://gems.rubyforge.org/"]
- REMOTE SOURCES:
- http://gems.github.com/
- http://gems.rubyforge.org/
I have also tried specifying github as the source with no luck. What else should I be trying?
You are using a very outdated version of RubyGems.
First, update the sources:
$ gem sources --clear-all
$ gem sources --add http://rubygems.org
$ gem sources --add http://gems.github.com
Then try to install it.
You should also login as a superuser and update the RubyGems version.
The current release is 1.3.7.

Resources