Solve multiple versions of rubigems

I have what looks like several versions of rubygems installed on my machine, when I gem list I see all my gems, but when I go to run scripts I get error messages like

Missing these required gems: SystemTimer 

Is there any methodology for removing all but one version of rubygems? Ideally, I would like to have access to all the gems that appear in the list of gems in my programs.

From the Gem Environment - RUBY EXECUTIVE: /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby

However, if I run:

 $ /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby script/mailer_daemon_fetcher start production no such file to load -- SystemTimer /Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in `gem_original_require' /Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in `require' /Library/Ruby/Gems/1.8/gems/activesupport-2.3.4/lib/active_support/dependencies.rb:156:in `require' /Library/Ruby/Gems/1.8/gems/activesupport-2.3.4/lib/active_support/dependencies.rb:521:in `new_constants_in' /Library/Ruby/Gems/1.8/gems/activesupport-2.3.4/lib/active_support/dependencies.rb:156:in `require' /Library/Ruby/Gems/1.8/gems/rails-2.3.4/lib/rails/gem_dependency.rb:208:in `load' /Library/Ruby/Gems/1.8/gems/rails-2.3.4/lib/initializer.rb:307:in `load_gems' /Library/Ruby/Gems/1.8/gems/rails-2.3.4/lib/initializer.rb:307:in `each' /Library/Ruby/Gems/1.8/gems/rails-2.3.4/lib/initializer.rb:307:in `load_gems' /Library/Ruby/Gems/1.8/gems/rails-2.3.4/lib/initializer.rb:164:in `process' /Library/Ruby/Gems/1.8/gems/rails-2.3.4/lib/initializer.rb:113:in `send' /Library/Ruby/Gems/1.8/gems/rails-2.3.4/lib/initializer.rb:113:in `run' ./script/../config/environment.rb:13 script/mailer_daemon_fetcher:5:in `require' script/mailer_daemon_fetcher:5 no such file to load -- SystemTimer /Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in `gem_original_require' /Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in `require' /Library/Ruby/Gems/1.8/gems/activesupport-2.3.4/lib/active_support/dependencies.rb:156:in `require' /Library/Ruby/Gems/1.8/gems/activesupport-2.3.4/lib/active_support/dependencies.rb:521:in `new_constants_in' /Library/Ruby/Gems/1.8/gems/activesupport-2.3.4/lib/active_support/dependencies.rb:156:in `require' /Library/Ruby/Gems/1.8/gems/rails-2.3.4/lib/rails/gem_dependency.rb:208:in `load' /Library/Ruby/Gems/1.8/gems/rails-2.3.4/lib/initializer.rb:307:in `load_gems' /Library/Ruby/Gems/1.8/gems/rails-2.3.4/lib/initializer.rb:307:in `each' /Library/Ruby/Gems/1.8/gems/rails-2.3.4/lib/initializer.rb:307:in `load_gems' /Library/Ruby/Gems/1.8/gems/rails-2.3.4/lib/initializer.rb:169:in `process' /Library/Ruby/Gems/1.8/gems/rails-2.3.4/lib/initializer.rb:113:in `send' /Library/Ruby/Gems/1.8/gems/rails-2.3.4/lib/initializer.rb:113:in `run' ./script/../config/environment.rb:13 script/mailer_daemon_fetcher:5:in `require' script/mailer_daemon_fetcher:5 Missing these required gems: SystemTimer You're running: ruby 1.8.7.72 at /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby rubygems 1.3.5 at /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8, /Library/Ruby/Gems/1.8 

Note that in the above, I manually call ruby ​​** / System / Library / Frameworks / Ruby.framework / Versions / 1.8 / usr / bin / ruby ​​** this is the same file as my / usr / bin / ruby, and my GEM_PATH has the value /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8

full output of the gem environment is available here: http://pastie.org/661104

+4
source share
4 answers

I have the feeling that you can use a different version of ruby ​​than ruby ​​gems. Either this, or the ruby ​​does not know where to look for their gems.

Refer to the gem installation guide to make sure your environment is set to use gems.

If you still have problems after the following instructions, make sure you do not have multiple versions of rubies. If you have multiple versions of Ruby, make sure your scripts invoke the same version of Ruby as the gem. This is done by comparing the gem environment list for RUBY_EXECUTABLE against the shebang line of your script. Double check to follow any symbolic links, because most distribution-based ruby ​​installations will symbolically link /usr/bin/ruby to /usr/bin/ruby1.8

You should also verify that your gems have been installed by the same user who runs the script.

If you started the gem installation without root privileges, the new stones will be installed in your home directory. If you use a script that depends on these gems as another user. These set gems will not be found. However, there is no problem if your gems are installed as root, and another user runs scripts that require these gems.

I ran into this problem when switching from Ruby to Ruby Enterprise Edition. I found that I had to re-install all my necessary gems using a gem REE instance.

+1
source

I think the problem in SystemTimer loads a little weird, so you need more configuration in environment.rb

It seems that the "problem" is due to the fact that the stone is called "SystemTimer", but you need to download "system_timer". To accomplish this with environment.rb, you must use:

  config.gem 'SystemTimer', :lib => 'system_timer' 

This seemed to solve the same problem for me.

+3
source
 gem cleanup 

it will remove all old versions of gem

you have problems with the environment - starting gem gets different than when you use rubygems in a script

Look at the output (especially the GEM PATHS)

 gem environment 

you can also compare ruby -e 'p ENV' results executed in the shell and execute p ENV somewhere in your code - look for differences in materials related to precious stones

+1
source

Using RVM https://rvm.io/ , you can have different versions of Ruby (Enterprise Edition, MRI, Rubinius, etc.) and various gem kits.

Check it out, this is really useful!

+1
source

All Articles