CocoaPods
是 iOS 最常用最有名的类库管理工具
安装
# 添加源
$ sudo gem sources -a https://gems.ruby-china.org/
# 删除源
$ sudo gem sources -r https://rubygems.org/
# 安装
$ sudo gem install cocoapods
# 设置
$ pod setup
使用
# 搜索
$ pod search AFNetworking
# 生成 Podfile
$ echo "pod 'AFNetworking'" > Podfile
# 安装
$ pod install
# 升级
$ pod update
# 查看版本
$ pod --version
注意:
# 执行pod install还是pod update卡在了Analyzing dependencies不动
# 忽略升级CocoaPods的spec仓库
pod install --verbose --no-repo-update
pod update --verbose --no-repo-update
git 操作
# 将修改添加到暂存区
$ git add .
# 提交修改
$ git commit -m "添加 AFN框架程序"
gem 常用命令
# 查看gem源
$ gem sources –l
# gem自身升级
$ sudo gem update --system
# 查看版本
$ gem --version
# 清除过期的gem
$ sudo gem cleanup
# 安装包
$ sudo gem install cocoapods
# 删除包
$ gem uninstall cocoapods
# 更新包
$ sudo gem update
# 列出本地安装的包
$ gem list
# 升级cocoapods
$ sudo gem install -n /usr/local/bin cocoapods --pre
换源为cocoapods pod upate 提速
新版的 CocoaPods 不允许用pod repo add直接添加master库了,但是依然可以:
$ cd ~/.cocoapods/repos
$ pod repo remove master
$ git clone https://mirrors.tuna.tsinghua.edu.cn/git/CocoaPods/Specs.git master
最后进入自己的工程,在自己工程的podfile第一行加上:
source 'https://mirrors.tuna.tsinghua.edu.cn/git/CocoaPods/Specs.git'
清华大学换源官方文档: https://mirror.tuna.tsinghua.edu.cn/help/CocoaPods/
插件
curl -fsSL https://raw.github.com/supermarin/Alcatraz/master/Scripts/install.sh | sh
github 地址:https://github.com/supermarin/Alcatraz