背景:
pod lib create xx 遇到 如下的问题:
pod lib create HYYFoundation
Cloning `https://github.com/CocoaPods/pod-template.git` into `HYYFoundation`.
Configuring HYYFoundation template.
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/universal-darwin22/rbconfig.rb:21: warning: Insecure world writable dir /opt/homebrew/bin in PATH, mode 040777
Ignoring ffi-1.15.5 because its extensions are not built. Try: gem pristine ffi --version 1.15.5
/Library/Ruby/Site/2.6.0/rubygems/specification.rb:1477:in `rescue in block in activate_dependencies': Could not find 'rexml' (~> 3.2.4) among 38 total gem(s) (Gem::MissingSpecError)
Checked in 'GEM_PATH=/Users/liyazhu/.gem/ruby/2.6.0:/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/gems/2.6.0:/opt/homebrew/Cellar/cocoapods/1.13.0/libexec' at: /opt/homebrew/Cellar/cocoapods/1.13.0/libexec/specifications/xcodeproj-1.23.0.gemspec, execute `gem env` for more information
from /Library/Ruby/Site/2.6.0/rubygems/specification.rb:1474:in `block in activate_dependencies'
from /Library/Ruby/Site/2.6.0/rubygems/specification.rb:1463:in `each'
from /Library/Ruby/Site/2.6.0/rubygems/specification.rb:1463:in `activate_dependencies'
from /Library/Ruby/Site/2.6.0/rubygems/specification.rb:1445:in `activate'
from /Library/Ruby/Site/2.6.0/rubygems.rb:210:in `rescue in try_activate'
from /Library/Ruby/Site/2.6.0/rubygems.rb:203:in `try_activate'
from /Library/Ruby/Site/2.6.0/rubygems/core_ext/kernel_require.rb:155:in `rescue in require'
from /Library/Ruby/Site/2.6.0/rubygems/core_ext/kernel_require.rb:40:in `require'
from /Users/liyazhu/Desktop/云仓配/HYYSepcs/HYYFoundation/setup/ProjectManipulator.rb:1:in `<top (required)>'
from ./configure:5:in `require_relative'
from ./configure:5:in `block in <main>'
from ./configure:4:in `each'
from ./configure:4:in `<main>'
/Library/Ruby/Site/2.6.0/rubygems/dependency.rb:315:in `to_specs': Could not find 'rexml' (~> 3.2.4) among 38 total gem(s) (Gem::MissingSpecError)
Checked in 'GEM_PATH=/Users/liyazhu/.gem/ruby/2.6.0:/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/gems/2.6.0:/opt/homebrew/Cellar/cocoapods/1.13.0/libexec' , execute `gem env` for more information
from /Library/Ruby/Site/2.6.0/rubygems/specification.rb:1475:in `block in activate_dependencies'
from /Library/Ruby/Site/2.6.0/rubygems/specification.rb:1463:in `each'
from /Library/Ruby/Site/2.6.0/rubygems/specification.rb:1463:in `activate_dependencies'
from /Library/Ruby/Site/2.6.0/rubygems/specification.rb:1445:in `activate'
from /Library/Ruby/Site/2.6.0/rubygems.rb:210:in `rescue in try_activate'
from /Library/Ruby/Site/2.6.0/rubygems.rb:203:in `try_activate'
from /Library/Ruby/Site/2.6.0/rubygems/core_ext/kernel_require.rb:155:in `rescue in require'
from /Library/Ruby/Site/2.6.0/rubygems/core_ext/kernel_require.rb:40:in `require'
from /Users/liyazhu/Desktop/云仓配/HYYSepcs/HYYFoundation/setup/ProjectManipulator.rb:1:in `<top (required)>'
from ./configure:5:in `require_relative'
from ./configure:5:in `block in <main>'
from ./configure:4:in `each'
from ./configure:4:in `<main>'
/Library/Ruby/Site/2.6.0/rubygems/specification.rb:1477:in `rescue in block in activate_dependencies': Could not find 'rexml' (~> 3.2.4) among 38 total gem(s) (Gem::MissingSpecError)
Checked in 'GEM_PATH=/Users/liyazhu/.gem/ruby/2.6.0:/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/gems/2.6.0:/opt/homebrew/Cellar/cocoapods/1.13.0/libexec' at: /opt/homebrew/Cellar/cocoapods/1.13.0/libexec/specifications/xcodeproj-1.23.0.gemspec, execute `gem env` for more information
from /Library/Ruby/Site/2.6.0/rubygems/specification.rb:1474:in `block in activate_dependencies'
from /Library/Ruby/Site/2.6.0/rubygems/specification.rb:1463:in `each'
from /Library/Ruby/Site/2.6.0/rubygems/specification.rb:1463:in `activate_dependencies'
from /Library/Ruby/Site/2.6.0/rubygems/specification.rb:1445:in `activate'
from /Library/Ruby/Site/2.6.0/rubygems.rb:204:in `try_activate'
from /Library/Ruby/Site/2.6.0/rubygems/core_ext/kernel_require.rb:155:in `rescue in require'
from /Library/Ruby/Site/2.6.0/rubygems/core_ext/kernel_require.rb:40:in `require'
from /Users/liyazhu/Desktop/云仓配/HYYSepcs/HYYFoundation/setup/ProjectManipulator.rb:1:in `<top (required)>'
from ./configure:5:in `require_relative'
from ./configure:5:in `block in <main>'
from ./configure:4:in `each'
from ./configure:4:in `<main>'
/Library/Ruby/Site/2.6.0/rubygems/dependency.rb:315:in `to_specs': Could not find 'rexml' (~> 3.2.4) among 38 total gem(s) (Gem::MissingSpecError)
Checked in 'GEM_PATH=/Users/liyazhu/.gem/ruby/2.6.0:/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/gems/2.6.0:/opt/homebrew/Cellar/cocoapods/1.13.0/libexec' , execute `gem env` for more information
from /Library/Ruby/Site/2.6.0/rubygems/specification.rb:1475:in `block in activate_dependencies'
from /Library/Ruby/Site/2.6.0/rubygems/specification.rb:1463:in `each'
from /Library/Ruby/Site/2.6.0/rubygems/specification.rb:1463:in `activate_dependencies'
from /Library/Ruby/Site/2.6.0/rubygems/specification.rb:1445:in `activate'
from /Library/Ruby/Site/2.6.0/rubygems.rb:204:in `try_activate'
from /Library/Ruby/Site/2.6.0/rubygems/core_ext/kernel_require.rb:155:in `rescue in require'
from /Library/Ruby/Site/2.6.0/rubygems/core_ext/kernel_require.rb:40:in `require'
from /Users/liyazhu/Desktop/云仓配/HYYSepcs/HYYFoundation/setup/ProjectManipulator.rb:1:in `<top (required)>'
from ./configure:5:in `require_relative'
from ./configure:5:in `block in <main>'
from ./configure:4:in `each'
from ./configure:4:in `<main>'
/Library/Ruby/Site/2.6.0/rubygems/core_ext/kernel_require.rb:86:in `require': cannot load such file -- xcodeproj (LoadError)
from /Library/Ruby/Site/2.6.0/rubygems/core_ext/kernel_require.rb:86:in `require'
from /Users/liyazhu/Desktop/云仓配/HYYSepcs/HYYFoundation/setup/ProjectManipulator.rb:1:in `<top (required)>'
from ./configure:5:in `require_relative'
from ./configure:5:in `block in <main>'
from ./configure:4:in `each'
from ./configure:4:in `<main>'
To learn more about the template see `https://github.com/CocoaPods/pod-template.git`.
To learn more about creating a new pod, see `https://guides.cocoapods.org/making/making-a-cocoapod`.
解决方案:
sudo gem install --user-install rexml
sudo gem install --user-install xcodeproj