【CocoaPods】CocoaPods基本安装教程
CocoaPods是什么,有什么用,怎么来等等我就不说了.反正就是一个管理第三方开源框架的~
1. 配置前 - 本地安装好Ruby环境
2. 安装命令 -> sudo gem install cocoapods
墙挡了.出这个错
ERROR: While executing gem ... (Gem::RemoteFetcher::FetchError) Errno::ECONNRESET: Connection reset by peer - SSL_connect (https://api.rubygems.org/quick/Marshal.4.8/cocoapods-0.39.0.gemspec.rz)
这是因为ruby的软件源rubygems.org因为使用亚马逊的云服务,还是墙..,需要更新一下ruby的源,过程如下:
Could not find a valid gem 'cocoapods' (>= 0) in any repository
$ gem sources -l (查看当前ruby的源)
$ gem sources --remove https://rubygems.org/
$ gem sources -a https://ruby.taobao.org/
$ gem sources -l
查看当前ruby的软件源
cuiwenlongdeMac-mini:~ cuiwenlong$ gem sources -l *** CURRENT SOURCES *** https://ruby.taobao.org/
加进ruby源之后,就再次安装,成功了
cuiwenlongdeMac-mini:~ cuiwenlong$ sudo gem install cocoapods Password: Fetching: nap-1.0.0.gem (100%) Successfully installed nap-1.0.0 Fetching: thread_safe-0.3.5.gem (100%) Successfully installed thread_safe-0.3.5 Fetching: minitest-5.8.3.gem (100%) Successfully installed minitest-5.8.3 Fetching: tzinfo-1.2.2.gem (100%) Successfully installed tzinfo-1.2.2 Fetching: i18n-0.7.0.gem (100%) Successfully installed i18n-0.7.0 Fetching: activesupport-4.2.5.gem (100%) Successfully installed activesupport-4.2.5 Fetching: escape-0.0.4.gem (100%) Successfully installed escape-0.0.4 Fetching: colored-1.2.gem (100%) Successfully installed colored-1.2 Fetching: molinillo-0.4.0.gem (100%) Successfully installed molinillo-0.4.0 Fetching: netrc-0.7.8.gem (100%) Successfully installed netrc-0.7.8 Fetching: cocoapods-trunk-0.6.4.gem (100%) Successfully installed cocoapods-trunk-0.6.4 Fetching: cocoapods-try-0.5.1.gem (100%) Successfully installed cocoapods-try-0.5.1 Fetching: cocoapods-stats-0.6.2.gem (100%) Successfully installed cocoapods-stats-0.6.2 Fetching: cocoapods-search-0.1.0.gem (100%) Successfully installed cocoapods-search-0.1.0 Fetching: cocoapods-plugins-0.4.2.gem (100%) Successfully installed cocoapods-plugins-0.4.2 Fetching: cocoapods-downloader-0.9.3.gem (100%) Successfully installed cocoapods-downloader-0.9.3 Fetching: claide-0.9.1.gem (100%) Successfully installed claide-0.9.1 Fetching: xcodeproj-0.28.2.gem (100%) Successfully installed xcodeproj-0.28.2 Fetching: fuzzy_match-2.0.4.gem (100%) Successfully installed fuzzy_match-2.0.4 Fetching: cocoapods-core-0.39.0.gem (100%) Successfully installed cocoapods-core-0.39.0 Fetching: cocoapods-0.39.0.gem (100%) Successfully installed cocoapods-0.39.0 Parsing documentation for nap-1.0.0 Installing ri documentation for nap-1.0.0 Parsing documentation for thread_safe-0.3.5 Installing ri documentation for thread_safe-0.3.5 Parsing documentation for minitest-5.8.3 Installing ri documentation for minitest-5.8.3 Parsing documentation for tzinfo-1.2.2 Installing ri documentation for tzinfo-1.2.2 Parsing documentation for i18n-0.7.0 Installing ri documentation for i18n-0.7.0 Parsing documentation for activesupport-4.2.5 Installing ri documentation for activesupport-4.2.5 Parsing documentation for escape-0.0.4 Installing ri documentation for escape-0.0.4 Parsing documentation for colored-1.2 Installing ri documentation for colored-1.2 Parsing documentation for molinillo-0.4.0 Installing ri documentation for molinillo-0.4.0 Parsing documentation for netrc-0.7.8 Installing ri documentation for netrc-0.7.8 Parsing documentation for cocoapods-trunk-0.6.4 Installing ri documentation for cocoapods-trunk-0.6.4 Parsing documentation for cocoapods-try-0.5.1 Installing ri documentation for cocoapods-try-0.5.1 Parsing documentation for cocoapods-stats-0.6.2 Installing ri documentation for cocoapods-stats-0.6.2 Parsing documentation for cocoapods-search-0.1.0 Installing ri documentation for cocoapods-search-0.1.0 Parsing documentation for cocoapods-plugins-0.4.2 Installing ri documentation for cocoapods-plugins-0.4.2 Parsing documentation for cocoapods-downloader-0.9.3 Installing ri documentation for cocoapods-downloader-0.9.3 Parsing documentation for claide-0.9.1 Installing ri documentation for claide-0.9.1 Parsing documentation for xcodeproj-0.28.2 Installing ri documentation for xcodeproj-0.28.2 Parsing documentation for fuzzy_match-2.0.4 Installing ri documentation for fuzzy_match-2.0.4 Parsing documentation for cocoapods-core-0.39.0 Installing ri documentation for cocoapods-core-0.39.0 Parsing documentation for cocoapods-0.39.0 Installing ri documentation for cocoapods-0.39.0 Done installing documentation for nap, thread_safe, minitest, tzinfo, i18n, activesupport, escape, colored, molinillo, netrc, cocoapods-trunk, cocoapods-try, cocoapods-stats, cocoapods-search, cocoapods-plugins, cocoapods-downloader, claide, xcodeproj, fuzzy_match, cocoapods-core, cocoapods after 15 seconds 21 gems installed
xcodeproj-0.28.2.gem 版本旧的话,可以更新一下
gem 更新命令 => sudo gem update —system
安装成功之后,安装Pod => 命令 : pod setup
错误 : error: RPC failed; result=18, HTTP code = 200
cuiwenlongdeMac-mini:~ cuiwenlong$ pod setup Setting up CocoaPods master repo [!] /usr/bin/git clone https://github.com/CocoaPods/Specs.git master --depth=1 Cloning into 'master'... error: RPC failed; result=18, HTTP code = 200 fatal: The remote end hung up unexpectedly
解决 : 200经典错误,网络连接错误,大概就是说哪个网站连接不上.我就重复继续安装就可以了..再次pod setut
错误 : active developer path ,选择默认的Xcode把
[!] Pod::Executable clone 'https://github.com/CocoaPods/Specs.git' master xcrun: error: active developer path ("/Users/xiakejie/工具/Xcode 2.app/Contents/Developer") does not exist, use xcode-select to change
解决 : sudo xcode-select -switch /Applications/Xcode-beta.app/Contents/Developers
(/Applications/Xcode-beta.app/Contents/Developers)这个是你Xcode路径
cuiwenlongdeMac-mini:~ cuiwenlong$ pod setup
Setting up CocoaPods master repo
Setup completed
解决 : 经典的Setup completed~ 搞掂
3. 使用CocoePod