Fix ruby gems path issues in debian
I’ve be banging my head against the wall trying to fix a ruby gems path without success. Here is my problem. In my production server running
Debian GNU/Linux 6.0.6 (squeeze) I have both ruby1.8.7, ruby1.9.1 and jruby installed. For some reasons gem install uses jruby gems directory and not ruby gems directory which means I can not run ruby programs that depends on installed ruby gems. I’ve tried to export the ruby gem PATH using
but nothing changed.
Here is my
# ~/.bashrc: executed by bash(1) for non-login shells. export PS1='\h:\w\$ ' umask 022 # You may uncomment the following lines if you want `ls' to be colorized: # export LS_OPTIONS='--color=auto' # eval "`dircolors`" # alias ls='ls $LS_OPTIONS' # alias ll='ls $LS_OPTIONS -l' # alias l='ls $LS_OPTIONS -lA' # # Some more alias to avoid making mistakes: # alias rm='rm -i' # alias cp='cp -i' # alias mv='mv -i' JAVA_HOME=/usr/bin/jdk1.6.0_21/ PATH="/usr/bin/jdk1.6.0_21/bin:$PATH" PATH="$PATH:/opt/jruby/bin/" export PATH export GEM_PATH=/usr/lib/ruby/gems/1.8
No LSB modules are available. Distributor ID: Debian Description: Debian GNU/Linux 6.0.6 (squeeze) Release: 6.0.6 Codename: squeeze gem env RubyGems Environment: - RUBYGEMS VERSION: 1.8.16 - RUBY VERSION: 1.8.7 (2011-12-27 patchlevel 330) [java] - INSTALLATION DIRECTORY: /opt/jruby/lib/ruby/gems/1.8 - RUBY EXECUTABLE: /opt/jruby/bin/jruby - EXECUTABLE DIRECTORY: /opt/jruby/bin - RUBYGEMS PLATFORMS: - ruby - universal-java-1.6 - GEM PATHS: - /opt/jruby/lib/ruby/gems/1.8 - /usr/lib/ruby/gems/1.8 - GEM CONFIGURATION: - :update_sources => true - :verbose => true - :benchmark => false - :backtrace => false - :bulk_threshold => 1000 - "install" => "--no-rdoc --no-ri --env-shebang" - "update" => "--no-rdoc --no-ri --env-shebang" - REMOTE SOURCES: - http://rubygems.org/ which ruby /usr/bin/ruby which gem /opt/jruby/bin//gem
Here is the error I’m getting while running ruby file
usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:36:in `gem_original_require': no such file to load -- net/https (LoadError) from /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:36:in `require'
I’ve been struggling to change that but with no luck. How do I change gem path on Debian?
One Solution collect form web for “Fix ruby gems path issues in debian”
Are you using a version manager like RVM/rbenv? They implement custom path modification.
Do you know which user you are running as and if you are using
sudo? This can of course also have a huge impact on path interpretation.
Try this: navigate into the actual
Bin folder of each of your Ruby implementations, and run the
gem env command there. This has the effect running commands using that localized version of Ruby (and therefore RubyGems too in most cases). This can be very helpful in diagnosing these types of issues.