Mac OS 10.15.7
ABCD-MBP:~ abcd$ which ruby
/usr/local/opt/ruby/bin/ruby
ABCD-MBP:~ abcd$ ruby -v
ruby 3.0.2p107 (2021-07-07 revision 0db68f0233) [x86_64-darwin19]
吊舱设置
Traceback (most recent call last):
3: from /usr/local/bin/pod:22:in `<main>'
2: from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_gem.rb:65:in `gem'
1: from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/dependency.rb:323:in `to_spec'
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/dependency.rb:311:in `to_specs': Could not find 'cocoapods' (>= 0.a) among 48 total gem(s) (Gem::MissingSpecError)
Checked in 'GEM_PATH=/Users/abcd/.gem/ruby/2.6.0:/Library/Ruby/Gems/2.6.0:/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/gems/2.6.0', execute `gem env` for more information
我不明白为什么这里会提到ruby的旧版本?
使用xcode>pod安装失败,因为ruby的旧版本也被引用。
Traceback (most recent call last):
3: from /usr/local/bin/pod:22:in `<main>'
2: from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_gem.rb:65:in `gem'
1: from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/dependency.rb:323:in `to_spec'
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/dependency.rb:311:in `to_specs': Could not find 'cocoapods' (>= 0.a) among 48 total gem(s) (Gem::MissingSpecError)
Checked in 'GEM_PATH=/Users/abcd/.gem/ruby/2.6.0:/Library/Ruby/Gems/2.6.0:/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/gems/2.6.0', execute `gem env` for more information
我尝试了在中提出的不同解决方案,但无法修复此问题
卸载所有gems并重新安装
卸载pod并重新安装
1条答案
按热度按时间zfycwa2u1#
当默认mac与您安装的ruby版本不同时,就会出现此问题
我可以通过安装与mac os ruby framework相同的ruby版本来解决这个问题。移除所有宝石,重新安装吊舱。
参考资料
https://github.com/cocoapods/cocoapods/issues/10246#issuecomment-761719446
https://superuser.com/questions/340490/how-to-install-and-use-different-versions-of-ruby
https://rvm.io/rvm/install
https://jeffreymorgan.io/articles/ruby-on-macos-with-rvm/
https://github.com/rvm/rvm/issues/4215
在osx中卸载所有已安装的gems?
自制卸载ruby
https://rvm.io/rubies/default
我想知道苹果的工程师们能从中得到什么乐趣,使pod+ruby成为如此复杂的东西来修复:)