安裝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`
遇到的問題
安裝的時(shí)候遇到很多問題溺健,安裝不成功嘀略,好多說因?yàn)閴Φ脑蜚灸枰鼡Q源站章鲤,但是親測如下源站都無法安裝成功挠蛉,好多都報(bào)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)
執(zhí)行 gem sources -l 查看當(dāng)前源站辐益,竟然沒有断傲。
多次嘗試,發(fā)現(xiàn)執(zhí)行命令時(shí)智政,后面直接加上源站的地址认罩,就可以正常安裝了。
--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可以顯示詳細(xì)的檢測過程垦垂,出錯(cuò)時(shí)會(huì)顯示詳細(xì)的錯(cuò)誤信息
pod install --verbose --repo-update
// 只安裝新添加的庫
pod install --verbose --no-repo-update
// 會(huì)在安裝相關(guān)庫時(shí) 更新其他庫版本
pod update --verbose --no-repo-update
// 只更新指定的庫宦搬,其它庫忽略
pod update ** --verbose --no-repo-update