cocoaPod安装

2019-10-04  本文已影响0人  Berning

一、安装rvm(ruby version manager)和检查更新ruby

  1. 安装rvm
$ rvm -v  
$ rvm -v  
rvm 1.29.9 (latest) by Michal Papis, Piotr Kuczynski, Wayne E. Seguin [https://rvm.io]
$ rvm -v  
-bash: rvm: command not found
//$ curl -sSL https://get.rvm.io | bash -s stable   (参考 https://rvm.io)
$ curl -L https://get.rvm.ip|bash -s stable
$ rvm -v  
rvm 1.29.9 (latest) by Michal Papis, Piotr Kuczynski, Wayne E. Seguin [https://rvm.io]

source  /Users/username/.rvm/scripts/rvm 
  1. Mac自带ruby,检查ruby环境,现在(2019/8/31)要求ruby环境at least 2.4.4,我的2.3.7
    -rvm查看ruby版本:
$ rvm list known
$ rvm install 2.7.0

然后根据提示按:回车-回车-输入密码,等待即可

二、RubyGems(参考:https://gems.ruby-china.com

  1. 检查更新RubyGems环境
$ gem -v  //建议2.6.x以上,我的2.5.2.3
$ sudo gem update --system
  1. 查看替换RubyGems源
$ gem sources -l 
https://rubygems.org/
$ gem sources --add https://gems.ruby-china.com/ --remove https://rubygems.org/

三、安装cocoapods和使用

$ sudo gem install -n /usr/local/bin cocoapods
pod init
vim Podfile
source 'https://github.com/CocoaPods/Specs.git'
platform:ios, '8.0'
target 'CocoaPodsTest' do
 pod 'AFNetworking'  '~>3.0'
end
pod install
上一篇下一篇

猜你喜欢

热点阅读