# Gem install failure - probably easy to fix

**URL:** <https://www.ruby-forum.com/t/gem-install-failure-probably-easy-to-fix/174797>\
**Category:** Ruby\
**Created:** [September 2, 2009, 11:07am UTC](https://www.ruby-forum.com/t/gem-install-failure-probably-easy-to-fix/174797 "2009-09-02T11:07:52Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![tbcox23](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/b9bd4f/32.png) [@tbcox23](https://www.ruby-forum.com/u/tbcox23)\
**Post date:** [September 2, 2009, 11:07am UTC](https://www.ruby-forum.com/t/gem-install-failure-probably-easy-to-fix/174797/1 "2009-09-02T11:07:52Z")

</div>

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](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 –

tomc@tomc-desktop:/$ 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…  
tomc@tomc-desktop:/$ gem list

\*\*\* LOCAL GEMS \*\*\*

rake (0.8.7)

tomc@tomc-desktop:/$ 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:
  - [http://gems.rubyforge.org/](http://gems.rubyforge.org/)

$ 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

–

```auto
Tom C., MS MA, LMHC - Private practice Psychotherapist
Bellingham, Washington, U.S.A: (360) 920-1226
<< removed_email_address@domain.invalid >> (email)
<< TomCloyd.com >> (website)
<< sleightmind.wordpress.com >> (mental health weblog)

```

---

<div class="post-metadata">

**Author:** ![tbcox23](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/b9bd4f/32.png) [@tbcox23](https://www.ruby-forum.com/u/tbcox23)\
**Post date:** [September 2, 2009, 3:45pm UTC](https://www.ruby-forum.com/t/gem-install-failure-probably-easy-to-fix/174797/2 "2009-09-02T15:45:55Z")

</div>

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: [RootSudo - Community Help Wiki](https://help.ubuntu.com/community/RootSudo))

Best regards,

Axel

---

<div class="post-metadata">

**Author:** ![tbcox23](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/b9bd4f/32.png) [@tbcox23](https://www.ruby-forum.com/u/tbcox23)\
**Post date:** [September 2, 2009, 5:03pm UTC](https://www.ruby-forum.com/t/gem-install-failure-probably-easy-to-fix/174797/3 "2009-09-02T17:03:47Z")

</div>

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

–

```auto
Tom C., MS MA, LMHC - Private practice Psychotherapist
Bellingham, Washington, U.S.A: (360) 920-1226
<< removed_email_address@domain.invalid >> (email)
<< TomCloyd.com >> (website)
<< sleightmind.wordpress.com >> (mental health weblog)

```

---

<div class="post-metadata">

**Author:** ![tbcox23](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/b9bd4f/32.png) [@tbcox23](https://www.ruby-forum.com/u/tbcox23)\
**Post date:** [September 2, 2009, 10:24pm UTC](https://www.ruby-forum.com/t/gem-install-failure-probably-easy-to-fix/174797/4 "2009-09-02T22:24:05Z")

</div>

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

> Datum: Thu, 3 Sep 2009 00:03:12 +0900  
> Von: Tom C. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
> An: removed\_email\_address@domain.invalid  
> 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

---

<div class="post-metadata">

**Author:** ![tbcox23](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/b9bd4f/32.png) [@tbcox23](https://www.ruby-forum.com/u/tbcox23)\
**Post date:** [September 3, 2009, 1:22am UTC](https://www.ruby-forum.com/t/gem-install-failure-probably-easy-to-fix/174797/5 "2009-09-03T01:22:39Z")

</div>

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.

–

```auto
Tom C., MS MA, LMHC - Private practice Psychotherapist
Bellingham, Washington, U.S.A: (360) 920-1226
<< removed_email_address@domain.invalid >> (email)
<< TomCloyd.com >> (website)
<< sleightmind.wordpress.com >> (mental health weblog)

```

---

<div class="post-metadata">

**Author:** ![tbcox23](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/b9bd4f/32.png) [@tbcox23](https://www.ruby-forum.com/u/tbcox23)\
**Post date:** [September 3, 2009, 1:45am UTC](https://www.ruby-forum.com/t/gem-install-failure-probably-easy-to-fix/174797/6 "2009-09-03T01:45:29Z")

</div>

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.

–

```auto
Tom C., MS MA, LMHC - Private practice Psychotherapist
Bellingham, Washington, U.S.A: (360) 920-1226
<< removed_email_address@domain.invalid >> (email)
<< TomCloyd.com >> (website)
<< sleightmind.wordpress.com >> (mental health weblog)

```

---

<div class="post-metadata">

**Author:** ![tbcox23](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/b9bd4f/32.png) [@tbcox23](https://www.ruby-forum.com/u/tbcox23)\
**Post date:** [September 2, 2009, 11:24pm UTC](https://www.ruby-forum.com/t/gem-install-failure-probably-easy-to-fix/174797/7 "2009-09-02T23:24:24Z")

</div>

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
