RubyGems installation errors both when using "sudo" and without using sudo

I have a machine running Ubuntu Hardy that provides its own RubyGems package. Unfortunately, this version of RubyGems (1.1.1) is too old to do anything useful, so I decided to manually upgrade RubyGems to the current version (1.3.6). This part went smoothly, and if I do gem -v, I get 1.3.6that which is expected. The problem is what I'm trying to do: sudo gem install rackit returns this error:

ERROR:  While executing gem ... (Errno::EACCES)
Permission denied - /home/username/.gem

Usually, when I install gems as root, it knows how to install it in /usr/lib/ruby/gems, so why does it even check my home directory? Another quirk when I do gem install rack(not as root), it says:

ERROR:  While executing gem ... (Gem::FilePermissionError)
You don't have write permissions into the /usr/lib/ruby/gems/1.8 directory.

where I want him to go. I already tried to clear source_caches, trying to use different versions of RubyGems (1.3.5), forcing installation in /usr/libwith to -ino avail. Any ideas on why RubyGems is so persistent in checking my directory /homewhen installing as root?

+5
source share
4 answers

It looks like this could be a channel issue coupled with having multiple versions.

Any difference in output between:

sudo gem env

and

gem env
+2
source

Try to run:

gem environment

and checking the values ​​for the GEM PATH. Additional information at http://docs.rubygems.org/read/chapter/10#page31

0
source

Fedora 15, "gem install" "--backtrace", , .

, /usr/lib/ruby/site _ruby/1.8/rubygems/doc_manager.rb:203, chdir ( , sudo as)

, , , , . cd , cd/, gem.

, / .

0

su (), chmod 755/usr/lib/ruby/gems/1.8

-3

All Articles