brew和gem都会在我运行它时抛出'Permission denied'错误 [英] brew and gem both throws 'Permission denied' error whenever I run it

查看:174
本文介绍了brew和gem都会在我运行它时抛出'Permission denied'错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

每当我运行'gem'或'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 '/bibrary/Ruby/Site/2.0.0/rubygems/stub_specification.rb:178:in'valid $'
from /Library/Ruby/Site/2.0.0/rubygems/specification。从/Library/Ruby/Site/2.0.0/rubygems/specification.rb:723:in`block(2 levels)in each_gemspec'
from /图书馆/红宝石/网站/ 2.0.0 /的rubygems / specification.rb:722:在从``/Library/Ruby/Site/2.0.0/rubygems/specification.rb:722:in块中的每个
来自/Library/Ruby/Site/2.0.0/rubyge的/Library/Ruby/Site/2.0.0/rubygems/specification.rb:721:in`each'
中的each_gemspec'
' ms / specification.rb:721:从`/Library/Ruby/Site/2.0.0/rubygems/specification.rb:729:``each_stms'
from / Library / Ruby / Site / 2.0.0 / ruby​​gems / specification.rb:748:在`stubs'中
来自/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:从/Library/Ruby/Site/2.0.0/rubygems.rb:983查找`find_latest_files'
;从/Library/Ruby/Site/2.0.0/rubygems/下载`load_plugins'
gem_runner.rb:81:在<< 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>'



我没有安装的CocoaPods,以及,当我检查的文件夹(/Library/Ruby/Gems/2.0.0/specifications/):

  -rw ------- 1根轮子1599 Apr 9 22:41 cocoapods-plugins-0.4.2。 gemspec 
-rwxr-XR-X 1个轮1376 2014年6月27日的CocoaPods-干线0.1.3.gemspec
-rwxr-XR-X 1根轮1376 2014年9月4日的CocoaPods干线-0.1。 4.gemspec
-rw ------- 1个根轮1290 Apr 9 22:41 cocoapods-trunk-0.6.0.gemspec
-rwxr-xr-x 1个根轮980 4月27日2014米的CocoaPods试-0.2.0.gemspec
-rwxr-XR-X 1根轮980 2014年6月27日的CocoaPods试-0.3.0.gemspec
-rw ------- 1根轮980 4月9日22:41 cocoapods-try-0.4.3.gemspec

看起来像我没有-r读取权限,当他使用'sudo'时,它们都运行良好,任何人都知道我做错了什么?要么我安装宝石或红宝石的方式,对不起,我是Ruby和宝石的完整n00b。我的gem命令位于'/ usr / bin / gem'中,并且我的brew命令位于'usr / local / bin / brew'非常感谢! / div>

好像你从root帐户安装它,并试图从没有权限的用户运行。


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!

解决方案

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

这篇关于brew和gem都会在我运行它时抛出'Permission denied'错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆