Problems with installing gems

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:

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:

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

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.

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