Error installing rvm gem?

I messed around with rubygems and rvm and it worked fine, but now when I try to install the gem, I get an error

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

This works when I do sudo, but I never had to do this before to install the 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/ 
+7
source share
1 answer

It looks like you installed the root user using the rvm installation, which is located in your home folder. This means that when you install gem with sudo, the files will be owned by root. So, when you try to install a gem like you, you get permission errors.

To fix this, you need to return the rvm folder to you (I assume that from your file paths your username is "da" here) ...

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

To avoid this in the future, I would recommend installing the root path of both your own rvm installation and system planes.

+30
source

All Articles