Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Permission denied error with RVM

I have searched for this problem and couldn't find relevant similar questions. Please bear with me if this is repetitive.

I have followed guides in RVM website to install RVM and I have installed rubies:

syed@rails:~$ rvm list

rvm rubies

   ruby-1.8.7-p302 [ i386 ]
=> ruby-1.9.2-p0 [ i386 ]

As you can see I have made ruby-1.9.2 my default.

This is my gem directory:

syed@rails:~$ rvm gemdir
/home/syed/.rvm/gems/ruby-1.9.2-p0

Now, I tried to install rails and I am thrown the following error:

syed@rails:~$ gem install rails
ERROR:  While executing gem ... (Errno::EACCES)
    Permission denied - /home/syed/.gem/specs

I even did this without making any difference to the error:

syed@rails:~$ chown -R syed /home/syed/.rvm/

Currently, my environment looks like this:

syed@rails:~$ gem environment
RubyGems Environment:
  - RUBYGEMS VERSION: 1.3.7
  - RUBY VERSION: 1.9.2 (2010-08-18 patchlevel 0) [i686-linux]
  - INSTALLATION DIRECTORY: /home/syed/.rvm/gems/ruby-1.9.2-p0@rails3
  - RUBY EXECUTABLE: /home/syed/.rvm/rubies/ruby-1.9.2-p0/bin/ruby
  - EXECUTABLE DIRECTORY: /home/syed/.rvm/gems/ruby-1.9.2-p0@rails3/bin
  - RUBYGEMS PLATFORMS:
    - ruby
    - x86-linux
  - GEM PATHS:
     - /home/syed/.rvm/gems/ruby-1.9.2-p0@rails3
     - /home/syed/.rvm/gems/ruby-1.9.2-p0@global
  - GEM CONFIGURATION:
     - :update_sources => true
     - :verbose => true
     - :benchmark => false
     - :backtrace => false
     - :bulk_threshold => 1000
  - REMOTE SOURCES:
     - http://rubygems.org/

I don't understand why it is trying to install gems to my system gem directory path?

like image 676
Syed Aslam Avatar asked Nov 29 '10 11:11

Syed Aslam


People also ask

What does RVM stand for ruby?

RVM stands for Ruby Version Manager. It is a command line tool which allows you to easily install, manage and work with different Ruby environments. With RVM, you can easily install different versions of Ruby and easily switch between them.

Can you use RVM on Windows?

RVM supports most UNIX like systems and Windows (with Cygwin or Bash on Ubuntu on Windows). The basic requirements are bash , curl , gpg2 and overall GNU version of tools - but RVM tries to autodetect it and install anything that is needed.

What is RVM used for?

As you can see, RVM is a versatile tool that can be used to manage projects and entire Ruby environments. You can use RVM to configure development conditions, server installations, and even to deploy your application.


1 Answers

I had this same problem and I resolved it by doing the following:

sudo mkdir ~/.gem/specs
sudo chmod 777 ~/.gem/specs

It seems that RVM was trying to create this "specs" folder, but didn't have permissions to do so.

like image 60
user531510 Avatar answered Nov 01 '22 10:11

user531510