You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

MacOS Ventura 13.0(22A380)更新后pod init无法运行求助

macOS Ventura 13.0 升级后 pod init 无法正常运行问题

问题背景

  • 设备:2019款15英寸MacBook Pro
  • 系统:macOS Ventura 13.0(22A380)
  • 故障:执行pod init命令报错,无法正常工作

报错信息

初始执行pod init的报错

Ignoring ffi-1.15.3 because its extensions are not built. Try: gem pristine ffi --version 1.15.3
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.11.3/lib/cocoapods/user_interface/error_report.rb:34:in `force_encoding': can't modify frozen String (FrozenError)
    from /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.11.3/lib/cocoapods/user_interface/error_report.rb:34:in `report'
    from /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.11.3/lib/cocoapods/command.rb:66:in `report_error'
    from /Library/Ruby/Gems/2.6.0/gems/claide-1.0.3/lib/claide/command.rb:396:in `handle_exception'
    from /Library/Ruby/Gems/2.6.0/gems/claide-1.0.3/lib/claide/command.rb:337:in `rescue in run'
    from /Library/Ruby/Gems/2.6.0/gems/claide-1.0.3/lib/claide/command.rb:324:in `run'
    from /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.11.3/lib/cocoapods/command.rb:52:in `run'
    from /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.11.3/bin/pod:55:in `<top (required)>'
    from /usr/local/bin/pod:23:in `load'
    from /usr/local/bin/pod:23:in `<main>'
/Library/Ruby/Gems/2.6.0/gems/xcodeproj-1.21.0/lib/xcodeproj/project.rb:228:in `initialize_from_file': [Xcodeproj] Unknown object version (56). (RuntimeError)
    from /Library/Ruby/Gems/2.6.0/gems/xcodeproj-1.21.0/lib/xcodeproj/project.rb:113:in `open'
    from /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.11.3/lib/cocoapods/command/init.rb:41:in `validate!'
    from /Library/Ruby/Gems/2.6.0/gems/claide-1.0.3/lib/claide/command.rb:333:in `run'
    from /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.11.3/lib/cocoapods/command.rb:52:in `run'
    from /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.11.3/bin/pod:55:in `<top (required)>'
    from /usr/local/bin/pod:23:in `load'
    from /usr/local/bin/pod:23:in `<main>'

尝试修复时的权限报错

执行提示命令gem pristine ffi --version 1.15.3时:

ERROR:  While executing gem ... (Gem::FilePermissionError)
    You don't have write permissions for the /Library/Ruby/Gems/2.6.0 directory.

执行chmod ugo+rwx /Library/Ruby/Gems/2.6.0修改权限时:

chmod: Unable to change file mode on /Library/Ruby/Gems/2.6.0: Operation not permitted

解决方案

核心原因是系统自带Ruby版本与CocoaPods版本不兼容,加上macOS系统权限限制无法修改系统Ruby目录,推荐用Ruby版本管理器重新构建环境:

步骤1:安装rbenv

  1. 通过Homebrew安装rbenv:
    brew install rbenv
    
  2. 初始化rbenv到shell配置文件(zsh为例):
    echo 'eval "$(rbenv init - zsh)"' >> ~/.zshrc
    
    (bash用户替换为~/.bash_profile)
  3. 刷新终端配置:
    source ~/.zshrc
    

步骤2:安装兼容的Ruby版本

安装与当前系统、CocoaPods兼容的Ruby版本(如3.2.2):

rbenv install 3.2.2
rbenv global 3.2.2

步骤3:重新安装CocoaPods

先卸载旧版本:

sudo gem uninstall cocoapods

再用新Ruby版本安装:

gem install cocoapods

步骤4:验证功能

执行以下命令确认修复:

pod --version
pod init

替代方案(不推荐)

若不想用版本管理器,可尝试用用户权限安装gem:

gem install ffi --version 1.15.3 --user-install
gem pristine ffi --version 1.15.3 --user-install
gem install cocoapods --user-install

此方法可能后续仍出现兼容性问题,优先推荐版本管理器方案。

内容的提问来源于stack exchange,提问作者Pushpendra Kumar

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.15 15:25:16