cocoapods ERROR: Error installing cocoapods: ERROR: Failed to build gem native extension.

最近pod install 的时候总是报错,试了几次还是报

:cocoapods ERROR: Error installing cocoapods:

    ERROR: Failed to build gem native extension.

一气之下重新安装pod,成功解决报错,下面为安装不步骤,记录一下

1、安装Homebrew

/bin/zsh -c "$(curl -fsSL https://gitee.com/cunkai/HomebrewCN/raw/master/Homebrew.sh)"


2、通过brew安装ruby

(1)命令:brew install ruby

(2)配置环境变量:

echo 'export PATH="/usr/local/opt/ruby/bin:$PATH"' >> ~/.bash_profile

source ~/.bash_profile


3、安装 CocoaPods

(1)sudo gem install -n /usr/local/bin cocoapods

(2)pod repo update --verbose

4、替换镜像源

(1)移除:sudo gem sources--removehttps://rubygems.org/

(2)添加:sudo gem sources--addhttps://gems.ruby-china.com

(3)查看:gem sources -l

你可能感兴趣的:(cocoapods ERROR: Error installing cocoapods: ERROR: Failed to build gem native extension.)