RubyGems installation errors both when using 'sudo' and not using sudo
Posted
by Kenny Peng
on Stack Overflow
See other posts from Stack Overflow
or by Kenny Peng
Published on 2010-04-21T16:40:15Z
Indexed on
2010/04/21
17:53 UTC
Read the original article
Hit count: 491
I have a machine that is running Ubuntu Hardy, which provides its own RubyGems package. Unfortunately that version of RubyGems (1.1.1) is too old to do anything useful with, so I decided to manually update RubyGems to the current version (1.3.6). That part went smoothly, and if I do gem -v
, I get 1.3.6
which is expected. The problem is when I try to do: sudo gem install rack
, it returns this error:
ERROR: While executing gem ... (Errno::EACCES)
Permission denied - /home/username/.gem
Usually when I install gems as root, it knows to install it into /usr/lib/ruby/gems
, so why is it checking my home directory at all? Another quirk is 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.
which is where I want it to go. I've already tried clearing source_caches, trying different versions of RubyGems (1.3.5), forcing installation into /usr/lib
with -i
to no avail. Any ideas on why RubyGems is so insistent on checking my /home
directory when installing as root?
© Stack Overflow or respective owner