1. 更换Ruby源为ruby-china
查看现有的ruby源:gem source
[一般默认的结果为: https://rubygems.org/]
删除现有的ruby源:gem sources --remove https://rubygems.org/
添加新源:gem source -a http://gems.ruby-china.com
[查看新的源是否被替换:gem source]
2. 安装CocoaPos
// Mac OS X 10.11前
sudo gem install cocoapods
//Mac OS X 10.11后
sudo gem install -n /usr/local/bin cocoapods
pod setup
pod —version
3. 在xcode的项目文件夹下面
pod install
如果出现一下错误:
[!] Unable to add a sourcewithurl`https://github.com/CocoaPods/Specs.git`named`master`.
You cantryadding it manuallyin`~/.cocoapods/repos`or via`pod repo add`.
解决办法:
cd ~/.CocoaPods/repos/
如果该目录下面存在master目录,则 sudo rm -rf master 删除该文件夹
git clone https://github.com/CocoaPods/Specs.git master
等待安装完毕
pod setup
网友评论