CocoaPods安装

换镜像源
gem sources --remove https://rubygems.org/
gem sources -a http://gems.ruby-china.org/
gem sources -l

终端输入:sudo gem install cocoapods

输入完这一句代码后可能会出现一个错误
ERROR: While executing gem ... (Gem::DependencyError)
Unable to resolve dependencies: cocoapods requires cocoapods-core (= 0.33.1), claide (~> 0.6.1), cocoapods-downloader (~> 0.6.1), cocoapods-plugins (~> 0.2.0), cocoapods-try (~> 0.3.0), cocoapods-trunk (~> 0.1.1), nap (~> 0.7)

解决方法:sudo gem update --system

但是出现了另一个错误:

ERROR: While executing gem ... (Errno::EPERM)
Operation not permitted - /usr/bin/xcodeproj

于是上网查找了一下 问了一些朋友,于是在一个朋友的帮助下 得到了答案,他给我一个连接上面是一个网友的总结。他是在Stackoverflow上找到的解决方法(在此推荐网友可以多去这个网站看看,上面有很多中外的大牛回答的问题,对工作很久的大牛都是知识的宝藏,更何况对于我们这些菜鸟而言呢)
解决方法如下

在终端中输入:sudo nvram boot-args="rootless=0"; sudo reboot
然后你的电脑会重启
之后再输入 sudo gem install cocoapods -V

sudo gem install -n /usr/local/bin cocoapods

ERROR: While executing gem ... (Errno::EPERM)
Operation not permitted - /usr/bin/xcodeproj

sudo gem install -n /usr/local/bin cocoapods

pod --version

~ crane$ pod search fmdb
[!] Unable to find a pod with name, author, summary, or description matching fmdb
// 删除suo
~ crane$ rm ~/Library/Caches/CocoaPods/search_index.json
~ crane$ pod search fmdb

你可能感兴趣的:(CocoaPods安装)