今天想使用Realm,pod install之后发现pod版本过低了,尝试更新pod之后,pod突然出了问题,执行pod install就一直失败。只好重新安装
1.尝试使用 sudo gem install cocoapods
一直失败,报错类似"Failed to build gem native extension",看问题似乎是ruby有问题,但通过查询ruby版本没问题,不过重新安装似乎也一直不成功,然后尝试用brew 安装
2.brew install cocoapods
这个一开始也是一直报错,失败。我在想是不是真的ruby不对,先尝试使用brew重装ruby试下
3.brew install ruby
这个装的东西巨多,但安装还算顺利,我安装了ruby一半,尝试重新执行步骤2去安装pod,发现可能是ruby环境正常了,pod安装成功了。但还是报错“Error: The brew link
step did not complete successfully
The formula built, but is not symlinked into /usr/local
Could not symlink bin/xcodeproj”
Target /usr/local/bin/xcodeproj
already exists. You may want to remove it:
rm '/usr/local/bin/xcodeproj'
To force the link and overwrite all conflicting files:
brew link --overwrite cocoapods
To list all files that would be deleted:
brew link --overwrite --dry-run cocoapods
Possible conflicting files are:
看了下报错信息尝试使用
4. brew link --overwrite cocoapods
然后一切正常,pod终于可以用了