I got a Ubuntu 12.04 instance in AWS EC2.
I just want to gem install rails.
But it shows this error message.
Is this caused by the difference gem env between sudo gem env?
Is there any ways to solve this problem except rvm implode?
What's the risk of using rvmsudo instead?
Fetching: atomic-1.1.15.gem (100%)
ERROR: While executing gem ... (Gem::FilePermissionError)
You don't have write permissions for the /usr/local/rvm/gems/ruby-1.9.3-p545@global directory.
gem env:
RubyGems Environment:
- RUBYGEMS VERSION: 2.2.2
- RUBY VERSION: 1.9.3 (2014-02-24 patchlevel 545) [x86_64-linux]
- INSTALLATION DIRECTORY: /usr/local/rvm/gems/ruby-1.9.3-p545@global
- RUBY EXECUTABLE: /usr/local/rvm/rubies/ruby-1.9.3-p545/bin/ruby
- EXECUTABLE DIRECTORY: /usr/local/rvm/gems/ruby-1.9.3-p545@global/bin
- SPEC CACHE DIRECTORY: /home/ubuntu/.gem/specs
- RUBYGEMS PLATFORMS:
- ruby
- x86_64-linux
- GEM PATHS:
- /usr/local/rvm/gems/ruby-1.9.3-p545@global
- GEM CONFIGURATION:
- :update_sources => true
- :verbose => true
- :backtrace => false
- :bulk_threshold => 1000
- "gem" => "--no-ri --no-rdoc"
- REMOTE SOURCES:
- https://rubygems.org/
- SHELL PATH:
- /usr/local/rvm/gems/ruby-1.9.3-p545@global/bin
- /usr/local/rvm/rubies/ruby-1.9.3-p545/bin
- /usr/local/sbin
- /usr/local/bin
- /usr/sbin
- /usr/bin
- /sbin
- /bin
- /usr/games
- /usr/local/rvm/bin
sudo gem env:
RubyGems Environment:
- RUBYGEMS VERSION: 1.8.15
- RUBY VERSION: 1.8.7 (2011-06-30 patchlevel 352) [x86_64-linux]
- INSTALLATION DIRECTORY: /var/lib/gems/1.8
- RUBY EXECUTABLE: /usr/bin/ruby1.8
- EXECUTABLE DIRECTORY: /usr/local/bin
- RUBYGEMS PLATFORMS:
- ruby
- x86_64-linux
- GEM PATHS:
- /var/lib/gems/1.8
- /home/ubuntu/.gem/ruby/1.8
- GEM CONFIGURATION:
- :update_sources => true
- :verbose => true
- :benchmark => false
- :backtrace => false
- :bulk_threshold => 1000
- "gem" => "--no-ri --no-rdoc"
- REMOTE SOURCES:
- http://rubygems.org/
rvm is made to be used without sudo or specific/sudo rights. reinstall would be more appreciated. clean the current rvm install
rvmsudo rvm implode sudo rm -rf /etc/rvmrc /etc/profile.d/rvm.sh /usr/local/rvm
and then close all consoles/bashes/terminales and login in again with the user you want to use rvm with and install it again.Quite possibly, the
rvm
Ruby is separate and different from the system Ruby environment and depends on where whatgem
gets executed according to the path.However, it looks like you are running an rvm Ruby gem install as a different user as the owner of
/usr/local/rvm/gems
and it's subdirectories, which is supposed to be installed asrvmsudo
What user are you running the rvm gem install as?
You can try this:
Or also try like you mentioned
rvmsudo
. The risk there as the some of the files may haveroot
ownership which you may not want if you want to be more secure.Note that
rvmsudo
is not the recommended way but rather uservm
on your local directory. If you'd like to remove it you can do this:Then reinstall with just
rvm