Kevin
Kevin

Reputation: 635

rvm gem install error?

I was messing around with rubygems and rvm and it was working perfectly fine but now when I try to install a gem I get an error

gem install railsERROR: While executing gem ... (Errno::EACCES) Permission denied - /Users/da/.rvm/gems/ruby-1.9.2-p180/gems/bundler-1.0.11/.gitignore

It works when I do sudo, but I never had to do this before to install a gem.

$ gem env
RubyGems Environment:
  - RUBYGEMS VERSION: 1.6.2
  - RUBY VERSION: 1.9.2 (2011-02-18 patchlevel 180) [x86_64-darwin10.7.0]
  - INSTALLATION DIRECTORY: /Users/da/.rvm/gems/ruby-1.9.2-p180
  - RUBY EXECUTABLE: /Users/da/.rvm/rubies/ruby-1.9.2-p180/bin/ruby
  - EXECUTABLE DIRECTORY: /Users/da/.rvm/gems/ruby-1.9.2-p180/bin
  - RUBYGEMS PLATFORMS:
    - ruby
    - x86_64-darwin-10
  - GEM PATHS:
     - /Users/da/.rvm/gems/ruby-1.9.2-p180
     - /Users/da/.rvm/gems/ruby-1.9.2-p180@global
  - GEM CONFIGURATION:
     - :update_sources => true
     - :verbose => true
     - :benchmark => false
     - :backtrace => false
     - :bulk_threshold => 1000
  - REMOTE SOURCES:
     - http://rubygems.org/
$ sudo gem env
RubyGems Environment:
  - RUBYGEMS VERSION: 1.6.2
  - RUBY VERSION: 1.9.2 (2011-02-18 patchlevel 180) [x86_64-darwin10.7.0]
  - INSTALLATION DIRECTORY: /Users/da/.rvm/gems/ruby-1.9.2-p180
  - RUBY EXECUTABLE: /Users/danest/.rvm/rubies/ruby-1.9.2-p180/bin/ruby
  - EXECUTABLE DIRECTORY: /Users/da/.rvm/gems/ruby-1.9.2-p180/bin
  - RUBYGEMS PLATFORMS:
    - ruby
    - x86_64-darwin-10
  - GEM PATHS:
     - /Users/da/.rvm/gems/ruby-1.9.2-p180
     - /Users/da/.rvm/gems/ruby-1.9.2-p180@global
  - GEM CONFIGURATION:
     - :update_sources => true
     - :verbose => true
     - :benchmark => false
     - :backtrace => false
     - :bulk_threshold => 1000
  - REMOTE SOURCES:
     - http://rubygems.org/

Upvotes: 7

Views: 7724

Answers (1)

idlefingers
idlefingers

Reputation: 32037

It looks like you've set the root user to use the rvm install which is in your home folder. This means when you install a gem with sudo, the files will belong to root. So, when you try and install a gem as you, you're getting permission errors.

To fix, you need to chown the rvm folder back to you (I'm assuming, from your file paths, that your username is 'da' here)...

sudo chown -R da:da /Users/da/.rvm

To avoid this happening in the future, I'd recommend setting root's path to be either its own install of rvm, or system gems.

Upvotes: 30

Related Questions