1、查看ruby源
gem sources -l
2、移除掉原有的源
gem sources --remove https://rubygems.org/
**https://rubygems.org/ **是所查看到的源名称,需要全部移除
3、添加国内最新的源:ruby-china
gem sources -a http://gems.ruby-china.org
**https://gems.ruby-china.org**和**http://gems.ruby-china.org**是有区别的
4、检查是否添加成功
gem sources -l
5、安装cocoapods
sudo gem install -n /usr/local/bin cocoapods
6、安装完成后查看pod版本
pod --version
7、更新Podspec索引文件,创建本地索引库(这里要多等一会儿)
pod setup
8、进入项目目录
cd ~
9、创建Podfile文件
touch Podfile
10、编辑Podfile文件
1
2
3
4
5
6
7
8
9
|
platform :ios , '8.0' target 'NEW_BSBDJ' do pod 'AFNetworking' pod 'MJExtension' pod 'MJRefresh' pod 'SDWebImage' pod 'SVProgressHUD' end |
11、安装依赖库
pod install(后续添加框架可直接pod update)