安装CocoaPods & M1打包兼容

安装CocoaPods
sudo gem install cocoapods --source http://rubygems.org

安装成功

✘ jake@Jake  ~  sudo gem install cocoapods --source http://rubygems.org
Ignoring ffi-1.13.0 because its extensions are not built. Try: gem pristine ffi --version 1.13.0
Fetching activesupport-5.2.6.gem
Fetching public_suffix-4.0.6.gem
Fetching addressable-2.8.0.gem
Fetching cocoapods-core-1.10.1.gem
Fetching cocoapods-downloader-1.4.0.gem
Fetching nanaimo-0.3.0.gem
Fetching rexml-3.2.5.gem
Fetching xcodeproj-1.20.0.gem
Fetching cocoapods-1.10.1.gem
Successfully installed activesupport-5.2.6
Successfully installed public_suffix-4.0.6
Successfully installed addressable-2.8.0
Successfully installed cocoapods-core-1.10.1
Successfully installed cocoapods-downloader-1.4.0
Successfully installed nanaimo-0.3.0
Successfully installed rexml-3.2.5
Successfully installed xcodeproj-1.20.0
Successfully installed cocoapods-1.10.1
Parsing documentation for activesupport-5.2.6
Installing ri documentation for activesupport-5.2.6
Parsing documentation for public_suffix-4.0.6
Installing ri documentation for public_suffix-4.0.6
Parsing documentation for addressable-2.8.0
Installing ri documentation for addressable-2.8.0
Parsing documentation for cocoapods-core-1.10.1
Installing ri documentation for cocoapods-core-1.10.1
Parsing documentation for cocoapods-downloader-1.4.0
Installing ri documentation for cocoapods-downloader-1.4.0
Parsing documentation for nanaimo-0.3.0
Installing ri documentation for nanaimo-0.3.0
Parsing documentation for rexml-3.2.5
Installing ri documentation for rexml-3.2.5
Parsing documentation for xcodeproj-1.20.0
Installing ri documentation for xcodeproj-1.20.0
Parsing documentation for cocoapods-1.10.1
platform :ios, '8.0'
Installing ri documentation for cocoapods-1.10.1
Done installing documentation for activesupport, public_suffix, addressable, cocoapods-core, cocoapods-downloader, nanaimo, rexml, xcodeproj, cocoapods after 3 seconds
9 gems installed
安装 ffi
sudo gem install ffi --source http://rubygems.org

安装成功

 ✘ ⚙ jake@Jake  ~/Documents/code/iOS/CocoaPodsDemo  sudo gem install ffi --source http://rubygems.org
Fetching ffi-1.15.3.gem
Building native extensions. This could take a while...
Successfully installed ffi-1.15.3
Parsing documentation for ffi-1.15.3
Installing ri documentation for ffi-1.15.3
Done installing documentation for ffi after 4 seconds
1 gem installed
兼容M1 install ffi
sudo arch -x86_64 gem install ffi
 ✘ jake@Jake  ~/Documents/code/iOS/CocoaPodsDemo  sudo arch -x86_64 gem install ffi
Password:
Building native extensions. This could take a while...
Successfully installed ffi-1.15.3
Parsing documentation for ffi-1.15.3
Done installing documentation for ffi after 3 seconds
1 gem installed
兼容M1 pod install
arch -x86_64 pod install
 jake@Jake  ~/Documents/code/iOS/CocoaPodsDemo  arch -x86_64 pod install
Analyzing dependencies
Cloning spec repo `cocoapods` from `https://github.com/CocoaPods/Specs.git`

遇到的问题

安装的时候遇到很多问题,安装不成功,好多说因为墙的原因,需要更换源站,但是亲测如下源站都无法安装成功,好多都报404

jake@Jake  ~  gem sources -a http://ruby.taobao.org/
Ignoring ffi-1.13.0 because its extensions are not built. Try: gem pristine ffi --version 1.13.0
Error fetching http://ruby.taobao.org/:
    server did not return a valid file (http://ruby.taobao.org/specs.4.8.gz)
⚙ jake@Jake  ~/Documents/code/iOS/CocoaPodsDemo  gem sources --add http://gems.rubyforge.org
Error fetching http://gems.rubyforge.org:
    server did not return a valid file (http://gems.rubyforge.org/specs.4.8.gz)
jake@Jake  ~  gem sources -a http://ruby.taobao.org/
Ignoring ffi-1.13.0 because its extensions are not built. Try: gem pristine ffi --version 1.13.0
Error fetching http://ruby.taobao.org/:
    server did not return a valid file (http://ruby.taobao.org/specs.4.8.gz)

执行 gem sources -l 查看当前源站,竟然没有。

gem sources -l

多次尝试,发现执行命令时,后面直接加上源站的地址,就可以正常安装了。

 --source http://rubygems.org

完整命令如下:

sudo gem install cocoapods --source http://rubygems.org
sudo gem install ffi --source http://rubygems.org
更换源站命令
gem sources -a http://rubygems.org/
 ✘ ⚙ jake@Jake  ~/Documents/code/iOS/CocoaPodsDemo  gem sources -l
*** CURRENT SOURCES ***

http://rubygems.org/
 ✘ ⚙ jake@Jake  ~/Documents/code/iOS/CocoaPodsDemo  gem sources -a http://rubygems.org/
https://rubygems.org is recommended for security over http://rubygems.org/

Do you want to add this insecure source? [yn]  y
http://rubygems.org/ added to sources
附常用命令
// 更新本地所有库
pod repo update

// 更新本地指定库
pod repo update  ** 

// 安装并更新本地repo , --verbose可以显示详细的检测过程,出错时会显示详细的错误信息
pod install --verbose --repo-update

// 只安装新添加的库
pod install --verbose --no-repo-update 

// 会在安装相关库时 更新其他库版本
pod update --verbose --no-repo-update 

// 只更新指定的库,其它库忽略
pod update **  --verbose --no-repo-update 

你可能感兴趣的:(安装CocoaPods & M1打包兼容)