当我在终端上执行任何命令时,我收到“Permission denied”错误。 我正在使用的macbook在OS X 10.10.5上运行,而且这个macbook也是由我的公司提供的,所以它有一些权限级别。但我以管理员登录的身份登录。 当我执行“pod setup -verbose”命令时,我遇到了错误
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/specification.rb:959:in `read': Permission denied - /Library/Ruby/Gems/2.0.0/specifications/terminal-notifier-1.6.0.gemspec (Errno::EACCES)
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/specification.rb:959:in `load'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/specification.rb:644:in `block (2 levels) in each_spec'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/specification.rb:643:in `each'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/specification.rb:643:in `block in each_spec'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/specification.rb:642:in `each'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/specification.rb:642:in `each_spec'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/specification.rb:658:in `each_normal'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/specification.rb:669:in `_all'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/specification.rb:822:in `each'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/dependency.rb:253:in `find_all'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/dependency.rb:253:in `matching_specs'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/dependency.rb:277:in `to_specs'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/dependency.rb:307:in `to_spec'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_gem.rb:47:in `gem'
from /usr/bin/pod:22:in `<main>'
我尝试了几乎所有可用的解决方案,但我没有得到解决方案。请帮助他。
更新
如果我使用带有sudo的命令,我将收到以下错误。
/Library/Ruby/Gems/2.0.0/gems/claide-0.9.1/lib/claide/command.rb:417:in`help!':[!]你不能以root身份运行CocoaPods。 (CLAide ::帮助)
用法:
$ pod COMMAND
CocoaPods, the Cocoa library package manager.
命令:
+ cache Manipulate the CocoaPods cache
+ init Generate a Podfile for the current directory.
+ install Install project dependencies to Podfile.lock versions
+ ipc Inter-process communication
+ lib Develop pods
+ list List pods
+ outdated Show outdated project dependencies
+ repo Manage spec-repositories
+ setup Setup the CocoaPods environment
+ spec Manage pod specs
+ update Update outdated project dependencies and create new Podfile.lock
选项:
--silent Show nothing
--version Show the version of the tool
--verbose Show more debugging information
--no-ansi Show output without ANSI codes
--help Show help banner of specified command
from /Library/Ruby/Gems/2.0.0/gems/cocoapods-0.39.0/lib/cocoapods/command.rb:44:in `run'
from /Library/Ruby/Gems/2.0.0/gems/cocoapods-0.39.0/bin/pod:44:in `<top (required)>'
from /usr/bin/pod:23:in `load'
答案 0 :(得分:0)
我建议你看一下这篇文章
https://stackoverflow.com/a/14607772/5433235
您是否尝试安装rvm https://rvm.io/rvm/install,然后运行&#39; pod install&#39; ?
答案 1 :(得分:0)
尝试更新CocoaPods的权限
sudo chown -R $USER ~/Library/Caches/CocoaPods
sudo chown -R $USER ~/.cocoapods
尝试运行“pod install”并查看它是否解决了您的问题。
如果您仍然被拒绝,请尝试:
sudo chown -R $USER ./Pods
此外,您可能需要在运行pod install
之前删除旧的podfile.lock答案 2 :(得分:0)
根据您尝试运行的Pod更新,下载的原始文件夹可能没有给您读/写访问权限。导航到Finder中的该文件夹,然后右键单击以获取信息。转到权限并检查您的用户名是否已列出并具有读/写访问权限。如果没有添加您的用户名并给自己权利。