0

This happens whenever I ran 'gem' or 'brew':

/Library/Ruby/Site/2.0.0/rubygems/stub_specification.rb:75:in `initialize': Permission denied - /Library/Ruby/Gems/2.0.0/specifications/cocoapods-plugins-0.4.2.gemspec (Errno::EACCES)
from /Library/Ruby/Site/2.0.0/rubygems/stub_specification.rb:75:in `open'
from /Library/Ruby/Site/2.0.0/rubygems/stub_specification.rb:75:in `data'
from /Library/Ruby/Site/2.0.0/rubygems/stub_specification.rb:178:in `valid?'
from /Library/Ruby/Site/2.0.0/rubygems/specification.rb:731:in `block in each_stub'
from /Library/Ruby/Site/2.0.0/rubygems/specification.rb:723:in `block (2 levels) in each_gemspec'
from /Library/Ruby/Site/2.0.0/rubygems/specification.rb:722:in `each'
from /Library/Ruby/Site/2.0.0/rubygems/specification.rb:722:in `block in each_gemspec'
from /Library/Ruby/Site/2.0.0/rubygems/specification.rb:721:in `each'
from /Library/Ruby/Site/2.0.0/rubygems/specification.rb:721:in `each_gemspec'
from /Library/Ruby/Site/2.0.0/rubygems/specification.rb:729:in `each_stub'
from /Library/Ruby/Site/2.0.0/rubygems/specification.rb:748:in `stubs'
from /Library/Ruby/Site/2.0.0/rubygems/specification.rb:705:in `_all'
from /Library/Ruby/Site/2.0.0/rubygems/specification.rb:894:in `each'
from /Library/Ruby/Site/2.0.0/rubygems/specification.rb:1010:in `reverse_each'
from /Library/Ruby/Site/2.0.0/rubygems/specification.rb:1010:in `latest_specs'
from /Library/Ruby/Site/2.0.0/rubygems.rb:470:in `find_latest_files'
from /Library/Ruby/Site/2.0.0/rubygems.rb:983:in `load_plugins'
from /Library/Ruby/Site/2.0.0/rubygems/gem_runner.rb:81:in `<top (required)>'
from /Library/Ruby/Site/2.0.0/rubygems/core_ext/kernel_require.rb:54:in `require'
from /Library/Ruby/Site/2.0.0/rubygems/core_ext/kernel_require.rb:54:in `require'
from /usr/bin/gem:9:in `<main>'

I did install cocoapods as well, and when I checked the folder(/Library/Ruby/Gems/2.0.0/specifications/):

-rw-------   1 root  wheel  1599 Apr  9 22:41 cocoapods-plugins-0.4.2.gemspec
-rwxr-xr-x   1 root  wheel  1376 Jun 27  2014 cocoapods-trunk-0.1.3.gemspec
-rwxr-xr-x   1 root  wheel  1376 Sep  4  2014 cocoapods-trunk-0.1.4.gemspec
-rw-------   1 root  wheel  1290 Apr  9 22:41 cocoapods-trunk-0.6.0.gemspec
-rwxr-xr-x   1 root  wheel   980 Apr 27  2014 cocoapods-try-0.2.0.gemspec
-rwxr-xr-x   1 root  wheel   980 Jun 27  2014 cocoapods-try-0.3.0.gemspec
-rw-------   1 root  wheel   980 Apr  9 22:41 cocoapods-try-0.4.3.gemspec

It seems like I dont have the -r read permission for that and they all ran fine when I use 'sudo', anyone know what I did wrong? either the way I installed gem or ruby, sorry I am a complete n00b to Ruby and Gems. My gem command lives in '/usr/bin/gem' and my brew command lives in 'usr/local/bin/brew' Many thanks!

bfontaine
  • 18,169
  • 13
  • 73
  • 107
lorixx
  • 780
  • 1
  • 8
  • 13

1 Answers1

1

It seems like you install it from root account and trying to run from user that dont have permissions for it.

Łukasz Ostrowski
  • 1,566
  • 1
  • 9
  • 3
  • Indeed, thanks @Łukasz Ostrowski ! I actually solved it by using RVM, it's so much nicer and better. I was using the system native default ruby. After I installed RVM and re-install another ruby 2.1, everything works! – lorixx Apr 11 '15 at 17:09