From: Rick DeNatale Date: 2008-02-02T08:27:58+09:00 Subject: Re: Cannot run any gem as non-root user - freebsd 6.2 On Feb 1, 2008 5:37 PM, Gordon Pedersen wrote: > On my freeBSD 6.2 laptop I recently installed ruby 1.8.6 and ruby gems > from ports. Then (as root) used 'gem' to update itself and to install > rails. All of this proceeded without error - although it took so long > I'd hate to have to repeat it. > > > # cd /usr/ports/lang/ruby18 > # make install > # cd /usr/ports/devel/ruby-gems > # make install > # gem update --system > # gem install cheat > # gem install rails > > > (full list of installed gems near bottom) > > Now _as root_ I can run any gem I please simply by issuing > > # cheat # to run the 'cheat' gem > > > But _as ordinary user_ I cannot run any gem at all. Here is what I see > when I try to run the above 'cheat' gem (exact same thing happens if I > run 'rake'): > > > $ cheat > /usr/local/lib/ruby/site_ruby/1.8/rubygems.rb:350:in `insert': no > implicit conversion from nil to integer (TypeError) Looking at the code in rubygems.rb it looks like sitelibdir is nil. Just above that it got set sitelibdir = ConfigMap[:sitelibdir] Now ConfigMap gets set up up around line 74 et seq ConfigMap = {} unless defined?(ConfigMap) require 'rbconfig' RbConfig = Config unless defined? ::RbConfig ConfigMap.merge!( :BASERUBY => RbConfig::CONFIG["BASERUBY"], :EXEEXT => RbConfig::CONFIG["EXEEXT"], :RUBY_INSTALL_NAME => RbConfig::CONFIG["RUBY_INSTALL_NAME"], :RUBY_SO_NAME => RbConfig::CONFIG["RUBY_SO_NAME"], :arch => RbConfig::CONFIG["arch"], :bindir => RbConfig::CONFIG["bindir"], :libdir => RbConfig::CONFIG["libdir"], :ruby_install_name => RbConfig::CONFIG["ruby_install_name"], :ruby_version => RbConfig::CONFIG["ruby_version"], :sitedir => RbConfig::CONFIG["sitedir"], :sitelibdir => RbConfig::CONFIG["sitelibdir"] ) My guess is that, since you do seem to be able to run this as root that the permisions are screwed up on rbconfig.rb Now you need to find out where on the load path it's finding it. You might want to start out by using $locate rbconfig.rb although if it's not readable by the user used to build the locate database, you might have to use find as root. -- Rick DeNatale My blog on Ruby http://talklikeaduck.denhaven2.com/