RVM gem permissions error

14,029

You missed to use ruby, you can do it with:

rvm use 1.9.3 --install

In case 1.9.3 was not installed, this command will also install it!

It also looks you are using Ubuntu, make sure you are not using RVM from Ubuntu package - that thing is broken! You can find instruction how to fix it here: https://stackoverflow.com/a/9056395/497756

Share:
14,029
Mittenchops
Author by

Mittenchops

Updated on June 04, 2022

Comments

  • Mittenchops
    Mittenchops almost 2 years

    I started trying to set up a local rails installation for development. After I installed in using apt-get, however, I learned about RVM, so I removed the earlier one, and reinstalled from RVM. It looks like I have residual problems, though. Specifically, when I try to install rails I get...

    $ gem install rails
    ERROR:  While executing gem ... (Gem::FilePermissionError)
        You don't have write permissions into the /var/lib/gems/1.9.1 directory.
    

    This already looks like a problem, because I don't want it to be in the /var/ directory, I want it to be in the user directory. So, I check the following...

    $ gem env
    RubyGems Environment:
      - RUBYGEMS VERSION: 1.8.11
      - RUBY VERSION: 1.9.3 (2011-10-30 patchlevel 0) [x86_64-linux]
      - INSTALLATION DIRECTORY: /var/lib/gems/1.9.1
      - RUBY EXECUTABLE: /usr/bin/ruby1.9.1
      - EXECUTABLE DIRECTORY: /usr/local/bin
      - RUBYGEMS PLATFORMS:
        - ruby
        - x86_64-linux
      - GEM PATHS:
         - /var/lib/gems/1.9.1
         - /home/myusername/.gem/ruby/1.9.1
      - GEM CONFIGURATION:
         - :update_sources => true
         - :verbose => true
         - :benchmark => false
         - :backtrace => false
         - :bulk_threshold => 1000
      - REMOTE SOURCES:
         - http://rubygems.org/
    

    As well as sudo'd:

    $ sudo gem env
    RubyGems Environment:
      - RUBYGEMS VERSION: 1.8.11
      - RUBY VERSION: 1.9.3 (2011-10-30 patchlevel 0) [x86_64-linux]
      - INSTALLATION DIRECTORY: /var/lib/gems/1.9.1
      - RUBY EXECUTABLE: /usr/bin/ruby1.9.1
      - EXECUTABLE DIRECTORY: /usr/local/bin
      - RUBYGEMS PLATFORMS:
        - ruby
        - x86_64-linux
      - GEM PATHS:
         - /var/lib/gems/1.9.1
         - /home/myusername/.gem/ruby/1.9.1
      - GEM CONFIGURATION:
         - :update_sources => true
         - :verbose => true
         - :benchmark => false
         - :backtrace => false
         - :bulk_threshold => 1000
      - REMOTE SOURCES:
         - http://rubygems.org/
    

    gems seem to live in /var/lib for some reason. Is this normal? How can I fix this so I can install the rails gem?

    EDIT: UPDATE!

    It appears to me that I have gems installed twice, once in /var/lib/gems/1.9.91 (bad) and once in /home/myusername/.gem/ruby/1.9.1 (good).

    I think what is happening here is that when I type "gem" the installation in /var/lib/gems/1.9.1 (bad) is taking priority over /home/myusername/.gem/ruby/1.9.1 (good). Can anyone confirm that? Also, would it be OK and fix things just to delete the bad directory, or would that cause problems?

  • fdsaas
    fdsaas almost 12 years
    I'd also check out rvmrc files, which can be useful to automatically use versions of ruby and gemsets as you traverse your file system.
  • mpapis
    mpapis almost 12 years
    I think there was no research at all, best start is at rvm.io, it provides best set of information - updated to reflect current state of RVM.
  • Mittenchops
    Mittenchops almost 12 years
    $rvm use 1.9.3 --install RVM is not a function, selecting rubies with 'rvm use ...' will not work. You need to change your terminal settings to allow shell login. Please visit https://rvm.io/workflow/screen/ for example.
  • Mittenchops
    Mittenchops almost 12 years
    It looks like ruby is installed.
  • mpapis
    mpapis almost 12 years
    @Mittenchops you need to follow the instructions, I guess in your case rvm.io/integration/gnome-terminal is more appropriate.
  • Mittenchops
    Mittenchops almost 12 years
    That worked, but only after a reboot which threw me off. Thanks!