Gem install failure - probably easy to fix

I can get “gem install …” to execute, but not “sudo gem install…”.
I’ve always had to use the latter, and to my best knowledge still do,
but at present only the former works. I’ve never seen this problem, and
am baffled by it.

My questions:

  1. Why have I had to do “sudo gem install…” up to this point, and now
    that suddenly doesn’t work, but plain “gem install…” does?

My best guess is that it may have to do with where I installed ruby (I
was following the instructions found at
http://blog.michaelgreenly.com/2009/04/multiple-versions-of-ruby-on-ubuntu-3.html

  1. Do I have a problem here, or can I just go forward from this point?

My best guess is that there’s no problem. As I write this, all the gems
I’m requesting are installing just fine.

I use the webby gem a lot, and I just got IT to do its thing without a
problem.

  1. Finally, my “gem install…” of a dozen or so gem was successful, but
    after the ri documentation was installed, it crashed - here’s the last
    bit of the output:

Installing ri documentation for logging-1.2.2…
Installing ri documentation for loquacious-1.3.0…
Installing ri documentation for webby-0.9.4…
ERROR: While executing gem … (Errno::EACCES)
Permission denied - /home/tomc/.ri/cache/.doc_dirs

How do I get rdoc to run on all these gems? (There are about 20
installed, counting dependencies). I’d just fire up rdoc in my “home…
.gem” dir, but I’m afraid everything will end up in the same doc file.
Don’t know what to do here, and my study of the rdoc -h output isn’t
helping me.

Thanks for any help offered! (see below for environment details, etc.)

T.

===== Heres some relevant CLI output –

[email protected]:/$ gem install rake
WARNING: Installing to ~/.gem since
/opt/ruby-1.8.7-p160/lib/ruby/gems/1.8 and
/opt/ruby-1.8.7-p160/bin aren’t both writable.
Successfully installed rake-0.8.7
1 gem installed
Installing ri documentation for rake-0.8.7…
Installing RDoc documentation for rake-0.8.7…
[email protected]:/$ gem list

*** LOCAL GEMS ***

rake (0.8.7)

[email protected]:/$ rake -v
rake aborted!
No Rakefile found (looking for: rakefile, Rakefile, rakefile.rb,
Rakefile.rb)
/home/tomc/.gem/ruby/1.8/gems/rake-0.8.7/lib/rake.rb:2377:in
`raw_load_rakefile’
(See full trace by running task with --trace)

================
Environment details –

running Kubuntu Linux 9.0.4

I’ve just installed ruby 1.8.7 from source, and then rubygem 1.3.5, with
the result:

$ gem env
RubyGems Environment:

  • RUBYGEMS VERSION: 1.3.5
  • RUBY VERSION: 1.8.7 (2009-04-08 patchlevel 160) [i686-linux]
  • INSTALLATION DIRECTORY: /opt/ruby-1.8.7-p160/lib/ruby/gems/1.8
  • RUBY EXECUTABLE: /opt/ruby-1.8.7-p160/bin/ruby
  • EXECUTABLE DIRECTORY: /opt/ruby-1.8.7-p160/bin
  • RUBYGEMS PLATFORMS:
    • ruby
    • x86-linux
  • GEM PATHS:
    • /opt/ruby-1.8.7-p160/lib/ruby/gems/1.8
    • /home/tomc/.gem/ruby/1.8
  • GEM CONFIGURATION:
    • :update_sources => true
    • :verbose => true
    • :benchmark => false
    • :backtrace => false
    • :bulk_threshold => 1000
  • REMOTE SOURCES:

$ echo $PATH
/opt/ruby-1.8.7-p160/bin:/home/tomc/.gem/ruby/1.8/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games

Tom C., MS MA, LMHC - Private practice Psychotherapist
Bellingham, Washington, U.S.A: (360) 920-1226
<< [email protected] >> (email)
<< TomCloyd.com >> (website)
<< sleightmind.wordpress.com >> (mental health weblog)

Dear Tom,

ERROR: While executing gem … (Errno::EACCES)
Permission denied - /home/tomc/.ri/cache/.doc_dirs

you don’t have sufficient writing rights on that file, probably
because you installed the gems as normal user rather than with sudo
privileges.
There is by default no “root” user in Ubuntu like in other Linuxes,
but you can create one and use “gem install” as root:

sudo passwd root

  • and then do all sorts of (potentially dangerous things …)

(look here: https://help.ubuntu.com/community/RootSudo)

Best regards,

Axel

Axel E. wrote:

privileges.

Actually, no. I did install rubygems as root user. THEN I discovered
that “sudo gem install…” wouldn’t work, but “gem install…” would.

I don’t understand what happened.

t.

Best regards,

Axel

Tom C., MS MA, LMHC - Private practice Psychotherapist
Bellingham, Washington, U.S.A: (360) 920-1226
<< [email protected] >> (email)
<< TomCloyd.com >> (website)
<< sleightmind.wordpress.com >> (mental health weblog)

-------- Original-Nachricht --------

Datum: Thu, 3 Sep 2009 00:03:12 +0900
Von: Tom C. [email protected]
An: [email protected]
Betreff: Re: gem install failure - probably easy to fix

because you installed the gems as normal user rather than with sudo
privileges.

Actually, no. I did install rubygems as root user. THEN I discovered
that “sudo gem install…” wouldn’t work, but “gem install…” would.

I don’t understand what happened.

Tom,

then I’d guess that the cache file is locked (maybe by some other
installation process), and that you’d need to unlock it using eg., chown
.

Best regards,

Axel

Eric H. wrote:

Wow. Now that’s a redirect, folks. Completely solved my problem. Great
response, Eric.

AND…I find that “gem server” no longer works for me. There’s some kind
of strangeness in how my gems are installed. I’m looking into it.
Meanwhile, “gem help server” was so very helpful to me that I’m almost
inclined not to bother. Rubygems is an amazing piece of work. I can easy
fix THIS problem by sending the server to where the rdoc stuff actually
is, rather than to where it thinks it is. Cool.

Thanks, Eric.

t.

Tom C., MS MA, LMHC - Private practice Psychotherapist
Bellingham, Washington, U.S.A: (360) 920-1226
<< [email protected] >> (email)
<< TomCloyd.com >> (website)
<< sleightmind.wordpress.com >> (mental health weblog)

Axel E. wrote:

because you installed the gems as normal user rather than with sudo
Tom,

then I’d guess that the cache file is locked (maybe by some other
installation process), and that you’d need to unlock it using eg., chown .

Best regards,

Axel

Very interesting. Sometimes the obvious solution is the right solution,
and was in this case. Resetting permissions for the /ri dir fixed
everything.

Thanks!

t.

Tom C., MS MA, LMHC - Private practice Psychotherapist
Bellingham, Washington, U.S.A: (360) 920-1226
<< [email protected] >> (email)
<< TomCloyd.com >> (website)
<< sleightmind.wordpress.com >> (mental health weblog)

On Sep 2, 2009, at 02:03, Tom C. wrote:

How do I get rdoc to run on all these gems? (There are about 20
installed, counting dependencies). I’d just fire up rdoc in my
“home… .gem” dir, but I’m afraid everything will end up in the
same doc file. Don’t know what to do here, and my study of the rdoc -
h output isn’t helping me.

gem help rdoc

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs