Mac OS 10.12系统cocoapods安装

Deadly 提交于 2019-12-26 00:15:00

【推荐】2019 Java 开发者跳槽指南.pdf(吐血整理) >>>

从git上下载的项目运行后:The file “Pods.xcconfig” couldn’t be opened because there is no such file.

1、检查当前ruby版本

$gem sources -

成功后提示:

*** CURRENT SOURCES ***

https://ruby.taobao.org/

否则,移除现有的ruby:$gem sources --remove https://rubygems.org/;添加使用淘宝镜像:$gem sources -a https://ruby.taobao.org/

2、开始安装cocoapods

$sudo gem install cocoapods

运行后出现错误

2.1检查ruby版本

$ruby -v

ruby 2.0.0p648 (2015-12-16 revision 53162) [universal.x86_64-darwin15]

2.2需要升级ruby;

    查看目前所有ruby版本:$rvm list known 如果提示command not found

    $curl -L get.rvm.io | bash -s stable

    请先安装rvm:rvm install 2.2.2 ;如果不成功,检查homebrew卸载安装

    卸载:

ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/uninstall)"
Failed to locate Homebrew!

 解决问题:删除原来的安装目录

rm -rf Cellar Frameworks Homebrew

重新执行安装:

ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

运行后有下边提醒,则出现安装成功:

==> Installation successful!

 在执行:$ rvm install 2.2.2

    运行结果:

Please be aware that you just installed a ruby that requires        1 patches just to be compiled on an up to date linux system.

This may have known and unaccounted for security vulnerabilities.

Please consider upgrading to ruby-2.3.0 which will have all of the latest security patches.

Ruby was built without documentation, to build it run: rvm docs generate-ri成功

之后就开始安装cocoapods:$sudo gem install cocoapods

结果:

Installing ri documentation for cocoapods-1.0.1

Done installing documentation for nap, fourflusher, escape, colored, concurrent-ruby, thread_safe, tzinfo, i18n, activesupport, claide, xcodeproj, molinillo, cocoapods-try, netrc, cocoapods-trunk, cocoapods-stats, cocoapods-search, cocoapods-plugins, cocoapods-downloader, cocoapods-deintegrate, fuzzy_match, cocoapods-core, cocoapods after 146 seconds

23 gems installed

则安装成功 》

 

谨记:运行pod install时总是卡在Setting up CocoaPods master repo,因为这条命令被墙了,换成pod install --verbose --no-repo-update

pod update --- > pod update --verbose --no-repo-update

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!