可可豆荚在 Mac OS Monterey 上不起作用
Posted
技术标签:
【中文标题】可可豆荚在 Mac OS Monterey 上不起作用【英文标题】:cocoa pods does not work on Mac OS Monterey 【发布时间】:2021-11-22 01:54:19 【问题描述】:我已在 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 再次工作吗?
【问题讨论】:
您确认您使用的可可豆荚版本支持您使用的操作系统版本了吗? 嗯,最新的测试版没有问题。我在全新安装上运行它。 【参考方案1】:我必须从 Mac 上完全卸载 cocoapods,然后使用 rvm 安装旧版本的 ruby (ruby-2.6.0)
之后,我安装了最新的 cocoapods (11.0.2),一切都恢复正常了
【讨论】:
【参考方案2】:在我的例子中,我使用以下命令更新了 pod
sudo gem install cocoapods
在此之后pod init
工作正常
【讨论】:
以上是关于可可豆荚在 Mac OS Monterey 上不起作用的主要内容,如果未能解决你的问题,请参考以下文章
VirtualHosts 在 Mac OS 10.7 上不起作用
HTML5 地理定位在 Safari 上不起作用 - Mac OS/iOS
使用 JAVA 智能卡 API 读取 NFC 标签在 MAC OS 上不起作用
Mac OS X 可可应用程序中的 Internet 连接通知