我已经在 macOS Monterey 的最新测试版上更新到 Xcode 13.0,从那时起 cocoapods 停止工作。每当我尝试运行任何 pod 命令(pod init
, pod install
, pod --version
)时,它都会给我以下日志
Traceback (most recent call last):
14: from /Users/mahmoud/.rvm/gems/ruby-2.7.0-preview1/bin/ruby_executable_hooks:24:in `<main>'
13: from /Users/mahmoud/.rvm/gems/ruby-2.7.0-preview1/bin/ruby_executable_hooks:24:in `eval'
12: from /Users/mahmoud/.rvm/gems/ruby-2.7.0-preview1/bin/pod:23:in `<main>'
11: from /Users/mahmoud/.rvm/gems/ruby-2.7.0-preview1/bin/pod:23:in `load'
10: from /Users/mahmoud/.rvm/rubies/ruby-2.7.0-preview1/lib/ruby/gems/2.7.0/gems/cocoapods-1.11.2/bin/pod:36:in `<top (required)>'
9: from /Users/mahmoud/.rvm/rubies/ruby-2.7.0-preview1/lib/ruby/gems/2.7.0/gems/cocoapods-1.11.2/bin/pod:36:in `require'
8: from /Users/mahmoud/.rvm/rubies/ruby-2.7.0-preview1/lib/ruby/gems/2.7.0/gems/cocoapods-1.11.2/lib/cocoapods.rb:9:in `<top (required)>'
7: from /Users/mahmoud/.rvm/rubies/ruby-2.7.0-preview1/lib/ruby/gems/2.7.0/gems/cocoapods-1.11.2/lib/cocoapods.rb:9:in `require'
6: from /Users/mahmoud/.rvm/gems/ruby-2.7.0-preview1/gems/activesupport-6.1.4.1/lib/active_support/core_ext/array/conversions.rb:3:in `<top (required)>'
5: from /Users/mahmoud/.rvm/gems/ruby-2.7.0-preview1/gems/activesupport-6.1.4.1/lib/active_support/core_ext/array/conversions.rb:3:in `require'
4: from /Users/mahmoud/.rvm/gems/ruby-2.7.0-preview1/gems/activesupport-6.1.4.1/lib/active_support/xml_mini.rb:11:in `<top (required)>'
3: from /Users/mahmoud/.rvm/gems/ruby-2.7.0-preview1/gems/activesupport-6.1.4.1/lib/active_support/xml_mini.rb:17:in `<module:ActiveSupport>'
2: from /Users/mahmoud/.rvm/gems/ruby-2.7.0-preview1/gems/activesupport-6.1.4.1/lib/active_support/xml_mini.rb:94:in `<module:XmlMini>'
1: from /Users/mahmoud/.rvm/gems/ruby-2.7.0-preview1/gems/activesupport-6.1.4.1/lib/active_support/core_ext/module/delegation.rb:244:in `delegate'
/Users/mahmoud/.rvm/gems/ruby-2.7.0-preview1/gems/activesupport-6.1.4.1/lib/active_support/core_ext/module/delegation.rb:244:in `module_eval': /Users/mahmoud/.rvm/gems/ruby-2.7.0-preview1/gems/activesupport-6.1.4.1/lib/active_support/xml_mini.rb:94: syntax error, unexpected (..., expecting ')' (SyntaxError)
def parse(...); _ = backend; _.parse(......
^~~
/Users/mahmoud/.rvm/gems/ruby-2.7.0-preview1/gems/activesupport-6.1.4.1/lib/active_support/xml_mini.rb:94: syntax error, unexpected ')'
....); _ = backend; _.parse(...);rescue NoMethodError => e; ...
我尝试使用重新安装 cocoapods 但仍然有同样的问题
sudo gem uninstall cocoapods
sudo gem install cocoapods
这是我跑步时得到的gem list --local | grep cocoapods
cocoapods (1.11.2)
cocoapods-core (1.11.2, 1.10.0)
cocoapods-deintegrate (1.0.5, 1.0.4)
cocoapods-downloader (1.5.1, 1.4.0, 1.3.0, 1.2.2)
cocoapods-plugins (1.0.0)
cocoapods-search (1.0.1, 1.0.0)
cocoapods-stats (1.1.0)
cocoapods-trunk (1.6.0, 1.4.1, 1.3.1)
cocoapods-try (1.2.0, 1.1.0)
我也尝试重新安装activesupport,但效果不佳sudo gem install activesupport
我还尝试安装 ruby 的另一个版本(2.6.3),但遇到以下问题
==> Upgrading 6 outdated packages:
autoconf 2.69 -> 2.71
automake 1.16.1_1 -> 1.16.3_1
libksba 1.3.5 -> 1.5.1
libtool 2.4.6_1 -> 2.4.6_3
openssl@1.1 1.1.1g -> 1.1.1k
readline 8.0.4 -> 8.1
==> Upgrading openssl@1.1 1.1.1g -> 1.1.1k
==> Downloading https://www.openssl.org/source/openssl-1.1.1k.tar.gz
Already downloaded: /Users/mahmoud/Library/Caches/Homebrew/downloads/e82b2cc55210725ba34a740b4ca2a9b001e3a4f85f19e5b04b950e6dd2394e7c--openssl-1.1.1k.tar.gz
Error: Your Xcode does not support macOS 12.
It is either outdated or was modified.
Please update your Xcode or delete it if no updates are available.
Xcode can be updated from:
https://developer.apple.com/download/more/
Requirements installation failed with status: 1.
然后我再次尝试重新安装 Xcode 命令行工具,但遇到了同样的问题
知道如何让 cocoapod 再次工作吗?