我使用的是Catalina操作系统10.15.7和XCode版本12.4 (12D4e)。 我正在尝试使用gem安装CocoaPods:
sudo gem install cocoapods
我遇到了以下错误:
ERROR: While executing gem ... (Gem::FilePermissionError)
You don't have write permissions for the /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/gems/2.6.0 directory.
解决这个问题真是噩梦。 我尝试使用brew install,brew能够安装它,但是Pod无法正常工作。当我使用像这样的简单命令时
pod init
or
pod -v
我遇到了这个错误:
Traceback (most recent call last):
16: from /usr/local/Cellar/cocoapods/1.11.2_1/libexec/bin/pod:23:in `<main>'
15: from /Library/Ruby/Site/2.6.0/rubygems.rb:285:in `activate_bin_path'
14: from /Library/Ruby/Site/2.6.0/rubygems.rb:285:in `synchronize'
13: from /Library/Ruby/Site/2.6.0/rubygems.rb:286:in `block in activate_bin_path'
12: from /Library/Ruby/Site/2.6.0/rubygems/specification.rb:1369:in `activate'
11: from /Library/Ruby/Site/2.6.0/rubygems/specification.rb:1387:in `activate_dependencies'
10: from /Library/Ruby/Site/2.6.0/rubygems/specification.rb:1387:in `each'
9: from /Library/Ruby/Site/2.6.0/rubygems/specification.rb:1405:in `block in activate_dependencies'
8: from /Library/Ruby/Site/2.6.0/rubygems/specification.rb:1369:in `activate'
7: from /Library/Ruby/Site/2.6.0/rubygems/specification.rb:1387:in `activate_dependencies'
6: from /Library/Ruby/Site/2.6.0/rubygems/specification.rb:1387:in `each'
5: from /Library/Ruby/Site/2.6.0/rubygems/specification.rb:1405:in `block in activate_dependencies'
4: from /Library/Ruby/Site/2.6.0/rubygems/specification.rb:1369:in `activate'
3: from /Library/Ruby/Site/2.6.0/rubygems/specification.rb:1387:in `activate_dependencies'
2: from /Library/Ruby/Site/2.6.0/rubygems/specification.rb:1387:in `each'
1: from /Library/Ruby/Site/2.6.0/rubygems/specification.rb:1399:in `block in activate_dependencies'
/Library/Ruby/Site/2.6.0/rubygems/dependency.rb:311:in `to_specs': Could not find 'minitest' (>= 5.1) among 39 total gem(s) (Gem::MissingSpecError)
Checked in 'GEM_PATH=/Users/pankajnafria/.local/share/gem/ruby/2.6.0:/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/gems/2.6.0:/usr/local/Cellar/cocoapods/1.11.2_1/libexec' , execute `gem env` for more information
16: from /usr/local/Cellar/cocoapods/1.11.2_1/libexec/bin/pod:23:in `<main>'
15: from /Library/Ruby/Site/2.6.0/rubygems.rb:285:in `activate_bin_path'
14: from /Library/Ruby/Site/2.6.0/rubygems.rb:285:in `synchronize'
13: from /Library/Ruby/Site/2.6.0/rubygems.rb:286:in `block in activate_bin_path'
12: from /Library/Ruby/Site/2.6.0/rubygems/specification.rb:1369:in `activate'
11: from /Library/Ruby/Site/2.6.0/rubygems/specification.rb:1387:in `activate_dependencies'
10: from /Library/Ruby/Site/2.6.0/rubygems/specification.rb:1387:in `each'
9: from /Library/Ruby/Site/2.6.0/rubygems/specification.rb:1405:in `block in activate_dependencies'
8: from /Library/Ruby/Site/2.6.0/rubygems/specification.rb:1369:in `activate'
7: from /Library/Ruby/Site/2.6.0/rubygems/specification.rb:1387:in `activate_dependencies'
6: from /Library/Ruby/Site/2.6.0/rubygems/specification.rb:1387:in `each'
5: from /Library/Ruby/Site/2.6.0/rubygems/specification.rb:1405:in `block in activate_dependencies'
4: from /Library/Ruby/Site/2.6.0/rubygems/specification.rb:1369:in `activate'
3: from /Library/Ruby/Site/2.6.0/rubygems/specification.rb:1387:in `activate_dependencies'
2: from /Library/Ruby/Site/2.6.0/rubygems/specification.rb:1387:in `each'
1: from /Library/Ruby/Site/2.6.0/rubygems/specification.rb:1398:in `block in activate_dependencies'
/Library/Ruby/Site/2.6.0/rubygems/specification.rb:1401:in `rescue in block in activate_dependencies': Could not find 'minitest' (>= 5.1) among 39 total gem(s) (Gem::MissingSpecError)
Checked in 'GEM_PATH=/Users/pankajnafria/.local/share/gem/ruby/2.6.0:/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/gems/2.6.0:/usr/local/Cellar/cocoapods/1.11.2_1/libexec' at: /usr/local/Cellar/cocoapods/1.11.2_1/libexec/specifications/activesupport-6.1.4.1.gemspec, execute `gem env` for more information
非常感谢帮助解决此问题。