cocoapods提示: While executing gem … (Gem::FilePermissionError)

  • Post author:
  • Post category:其他


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.
    /Library/Ruby/Site/2.6.0/rubygems/installer.rb:712:in `verify_gem_home'
    /Library/Ruby/Site/2.6.0/rubygems/installer.rb:902:in `pre_install_checks'
    /Library/Ruby/Site/2.6.0/rubygems/installer.rb:302:in `install'
    /Library/Ruby/Site/2.6.0/rubygems/resolver/specification.rb:104:in `install'
    /Library/Ruby/Site/2.6.0/rubygems/request_set.rb:194:in `block in install'
    /Library/Ruby/Site/2.6.0/rubygems/request_set.rb:182:in `each'
    /Library/Ruby/Site/2.6.0/rubygems/request_set.rb:182:in `install'
    /Library/Ruby/Site/2.6.0/rubygems/commands/install_command.rb:214:in `install_gem'
    /Library/Ruby/Site/2.6.0/rubygems/commands/install_command.rb:230:in `block in install_gems'
    /Library/Ruby/Site/2.6.0/rubygems/commands/install_command.rb:223:in `each'
    /Library/Ruby/Site/2.6.0/rubygems/commands/install_command.rb:223:in `install_gems'
    /Library/Ruby/Site/2.6.0/rubygems/commands/install_command.rb:169:in `execute'
    /Library/Ruby/Site/2.6.0/rubygems/command.rb:323:in `invoke_with_build_args'
    /Library/Ruby/Site/2.6.0/rubygems/command_manager.rb:251:in `invoke_command'
    /Library/Ruby/Site/2.6.0/rubygems/command_manager.rb:191:in `process_args'
    /Library/Ruby/Site/2.6.0/rubygems/command_manager.rb:149:in `run'
    /Library/Ruby/Site/2.6.0/rubygems/gem_runner.rb:51:in `run'
    /usr/bin/gem:21:in `<main>'

出现上述错误时,处理情况三步走:

rvm install ruby-3.1.1
rvm use ruby-3.1.1 
rvm --default use 3.1.1

最后重新安装cocoapods

sudo gem install cocoapods

然后再重新下载支持库

 pod install



版权声明:本文为wangtianya125原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。