Mac OS 10.12系统cocoapods安装
1、检查当前ruby版本
$gem sources -
成功后提示:
*** CURRENT SOURCES ***
https://ruby.taobao.org/
否则,移除现有的ruby:$gem sources --remove https://rubygems.org/;添加使用淘宝镜像:$gem sources -a https://ruby.taobao.org/
2、开始安装cocoapods
$sudo gem install cocoapods
运行后出现错误
2.1检查ruby版本
$ruby -v
ruby 2.0.0p648 (2015-12-16 revision 53162) [universal.x86_64-darwin15]
2.2需要升级ruby;
查看目前所有ruby版本:$rvm list known 如果提示command not found
$curl -L get.rvm.io | bash -s stable
请先安装rvm:rvm install 2.2.2 ;
如果不成功,错误一:
Searching for binary rubies, this might take some time.
No binary rubies available for: osx/10.12/x86_64/ruby-2.2.2.
Continuing with compilation. Please read 'rvm help mount' to get more information on binary rubies.
Checking requirements for osx.
Missing required packages: autoconf automake libtool pkg-config libyaml readline libksba openssl
Somehow it happened there is no executable 'openssl',
run 'brew doctor' and make sure latest '' is installed properly.
Requirements installation successful.
Installing Ruby from source to: /Users/mac/.rvm/rubies/ruby-2.2.2, this may take a while depending on your cpu(s)...
ruby-2.2.2 - #downloading ruby-2.2.2, this may take a while depending on your connection...
先运行下面命令: rvm autolibs read-only
再执行 rvm:rvm install 2.2.2
错误二:
ruby-e"$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/uninstall)"Failed to locate Homebrew!
解决问题:删除原来的安装目录
rm-rf Cellar Frameworks Homebrew
重新执行安装:
ruby-e"$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
运行后有下边提醒,则出现安装成功:
==> Installation successful!
在执行:$ rvm install 2.2.2
运行结果:
Please be aware that you just installed a ruby that requires 1 patches just to be compiled on an up to date linux system.
This may have known and unaccounted for security vulnerabilities.
Please consider upgrading to ruby-2.3.0 which will have all of the latest security patches.
Ruby was built without documentation, to build it run: rvm docs generate-ri成功
之后就开始安装cocoapods:$sudo gem install cocoapods
结果:
Installing ri documentation for cocoapods-1.0.1
Done installing documentation for nap, fourflusher, escape, colored, concurrent-ruby, thread_safe, tzinfo, i18n, activesupport, claide, xcodeproj, molinillo, cocoapods-try, netrc, cocoapods-trunk, cocoapods-stats, cocoapods-search, cocoapods-plugins, cocoapods-downloader, cocoapods-deintegrate, fuzzy_match, cocoapods-core, cocoapods after 146 seconds
2.3 gems installed
则安装成功 》
谨记:运行pod install时总是卡在Setting up CocoaPods master repo,因为这条命令被墙了,换成pod install --verbose --no-repo-update
pod update --- > pod update --verbose --no-repo-update