# Problems with installing gems

**URL:** <https://www.ruby-forum.com/t/problems-with-installing-gems/217925>\
**Category:** Ruby\
**Created:** [March 16, 2012, 1:54pm UTC](https://www.ruby-forum.com/t/problems-with-installing-gems/217925 "2012-03-16T13:54:05Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![luislavena](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/0ea827/32.png) [@luislavena](https://www.ruby-forum.com/u/luislavena)\
**Post date:** [March 16, 2012, 1:54pm UTC](https://www.ruby-forum.com/t/problems-with-installing-gems/217925/1 "2012-03-16T13:54:05Z")

</div>

Hi!

I’d like to installed gem with

sudo gem install rails

By default, the rails gem should go into /usr/lib/ruby/gems/1.9.1, but  
it goes to /root/,gem:

[ram@thingol:~]sudo gem install rails --no-rdoc  
Password:  
WARNING: You don’t have /root/.gem/ruby/1.9.1/bin in your PATH,  
gem executables will not run.  
Successfully installed rails-3.2.2  
1 gem installed  
Installing ri documentation for rails-3.2.2…  
Updating ri class cache with 1090 classes…

Even if I give it the --install-dir option, it does the same:

[ram@thingol:~]sudo gem install rails --no-rdoc --install-dir  
/usr/lib/ruby/gems/1.9.1  
[13:46:27|12-03-16]  
WARNING: You don’t have /root/.gem/ruby/1.9.1/bin in your PATH,  
gem executables will not run.  
Successfully installed activesupport-3.2.2  
Successfully installed rails-3.2.2  
2 gems installed

I like the use the $HOME/.gem location for running test as a regular  
user, but not for root. Here is my gem env:

[ram@thingol:~]gem  
env  
[13:49:26|12-03-16]  
RubyGems Environment:

- RUBYGEMS VERSION: 1.8.17
- RUBY VERSION: 1.9.3 (2012-02-16 patchlevel 125) [x86\_64-linux]
- INSTALLATION DIRECTORY: /usr/lib/ruby/gems/1.9.1
- RUBY EXECUTABLE: /usr/bin/ruby
- EXECUTABLE DIRECTORY: /usr/bin
- RUBYGEMS PLATFORMS:
  - ruby
  - x86\_64-linux

- GEM PATHS:
  - /usr/lib/ruby/gems/1.9.1
  - /home/ram/.gem/ruby/1.9.1

- GEM CONFIGURATION:
  - :update\_sources =\> true
  - :verbose =\> true
  - :benchmark =\> false
  - :backtrace =\> false
  - :bulk\_threshold =\> 1000
  - “gem” =\> “–user-install”

- REMOTE SOURCES:
  - [http://rubygems.org/](http://rubygems.org/)

and for root:  
[ram@thingol:~]sudo gem  
env  
[13:49:28|12-03-16]  
RubyGems Environment:

- RUBYGEMS VERSION: 1.8.17
- RUBY VERSION: 1.9.3 (2012-02-16 patchlevel 125) [x86\_64-linux]
- INSTALLATION DIRECTORY: /usr/lib/ruby/gems/1.9.1
- RUBY EXECUTABLE: /usr/bin/ruby
- EXECUTABLE DIRECTORY: /usr/bin
- RUBYGEMS PLATFORMS:
  - ruby
  - x86\_64-linux

- GEM PATHS:
  - /usr/lib/ruby/gems/1.9.1
  - /root/.gem/ruby/1.9.1

- GEM CONFIGURATION:
  - :update\_sources =\> true
  - :verbose =\> true
  - :benchmark =\> false
  - :backtrace =\> false
  - :bulk\_threshold =\> 1000
  - “gem” =\> “–user-install”

- REMOTE SOURCES:
  - [http://rubygems.org/](http://rubygems.org/)

the line with - “gem” =\> “–user-install” looks suspicious, but how can  
I change it? Did I do a  
misconfiguration. I have no .gemrc file.

Any help is welcome!

regards  
ralf

---

<div class="post-metadata">

**Author:** ![Ralf\_M](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/13edae/32.png) [@Ralf\_M](https://www.ruby-forum.com/u/Ralf_M)\
**Post date:** [March 16, 2012, 5:50pm UTC](https://www.ruby-forum.com/t/problems-with-installing-gems/217925/2 "2012-03-16T17:50:46Z")

</div>

Ralf M. wrote in post #1051816:

> Hi!
> 
> I’d like to installed gem with
> 
> sudo gem install rails
> 
> […]
> 
> the line with - “gem” =\> “–user-install” looks suspicious, but how can  
> I change it? Did I do a  
> misconfiguration. I have no .gemrc file.

Look for ~/.gemrc

And then /etc/gemrc

You (in your profile) or your distro might be setting --user-install  
there.

–  
Luis L.

---

<div class="post-metadata">

**Author:** ![Ralf\_M](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/13edae/32.png) [@Ralf\_M](https://www.ruby-forum.com/u/Ralf_M)\
**Post date:** [March 16, 2012, 9:01pm UTC](https://www.ruby-forum.com/t/problems-with-installing-gems/217925/3 "2012-03-16T21:01:35Z")

</div>

On 03/16/2012 05:50 PM, Luis L. wrote:

> > I change it? Did I do a  
> > misconfiguration. I have no .gemrc file.
> 
> Look for ~/.gemrc
> 
> And then /etc/gemrc
> 
> You (in your profile) or your distro might be setting --user-install  
> there.

Thats it! /etc/gemrc contains

gem: --user-install

Thanks a lot  
ralf
