MAC安装CocoaPods遇到的错误Failed to build gem native extension.

MAC安装CocoaPods遇到的错误Failed to build gem native extension.

配置flutter环境的时候报错cocoapods不可用

发现已经安装了CocoaPods,但是不能用

重新安装CocaPods

复制代码
sudo gem install cocoapods

重新安装报错如下:

安装RVM

复制代码
curl -L https://get.rvm.io | bash -s stable

使用RVM管理Ruby

先下载ruby

复制代码
rvm install ruby-2.6

如果你的电脑是M1的,下载过程会出现一些错误;解决办法
点击查看解决办法

再次尝试下载下载

复制代码
sudo gem install cocoapods

又又又又报错了

复制代码
ERROR:  Error installing cocoapods:
	The last version of drb (>= 0) to support your Ruby & RubyGems was 2.0.6. Try installing it with `gem install drb -v 2.0.6` and then running the current command again
	drb requires Ruby version >= 2.7.0. The current ruby version is 2.6.10.210.

这个错误是我目前的Ruby是2.6.10.210版本的,版本比较低

需要下载>=2.7.0版本的

使用ruby管理工具rvm(没安装要先安装)进行下载

查看已经安装的Ruby

复制代码
rvm list

安装高版本的Ruby

复制代码
rvm install ruby-2.7.2

下载完成切换到2.7.2版本

复制代码
rvm use 2.7.2

然后再次下载cocoapods

复制代码
sudo gem install cocoapods

搞定!!

相关推荐
roman_日积跬步-终至千里8 小时前
【Go语言基础】基本语法
开发语言·golang·xcode
Hello.Reader11 小时前
Git 安装全攻略Linux、macOS、Windows 与源码编译
linux·git·macos
Hope Fancy11 小时前
macOS 连接 Docker 运行 postgres,使用navicat添加并关联数据库
macos·docker·postgresql
John Song11 小时前
macOS 上使用 Homebrew 安装redis-cli
数据库·redis·macos
yanjiee11 小时前
编译一个Mac M系列可以用的yuview
macos
数据知道11 小时前
Mac电脑上本地安装 redis并配置开启自启完整流程
数据库·redis·macos
电手17 小时前
Win10停更,Win11不好用?现在Mac电脑比Win11电脑更便宜
windows·macos·电脑·mac
Daniel_Coder17 小时前
Xcode 16.4 + iOS 18 系统运行时崩溃:___cxa_current_primary_exception 符号丢失的原因与解决方案
ios·xcode·ios 18·dyld·libc++abi
LAOning111 天前
xcode 各版本真机调试包下载
ide·macos·xcode
安和昂1 天前
【iOS】ARC 与 Autorelease
macos·ios·cocoa