如何下载和安装CocoaPods

如何下载和安装CocoaPods

https://zhidao.baidu.com/question/1862891903252349347.html?fr=iks&word=ERROR%3A+While+executing+gem+...+%28Errno%3A%3AEPERM%29+Operation+not+permitted+-+%2Fusr&ie=gbk


http://blog.csdn.net/hong1595/article/details/74010620

验证通过

iOS 最新版 CocoaPods 的安装流程

1.移除现有Ruby默认源

$gem sources --remove https://rubygems.org/

2.使用新的源

$gem sources -a https://ruby.taobao.org/

3.验证新源是否替换成功

$gem sources -l

4.安装CocoaPods

(1) $sudo gem install cocoapods 

备注:苹果系统升级 OS X EL Capitan 后改为

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


(2)$ pod setup


5.更新gem

$sudo gem update --system


一直不成功从新安装.


一丶 先安装 安装 Ruby运行环境

http://www.jianshu.com/p/c073e6fc01f5

安装了好久,终于看到成功再向我招手了


Last login: Fri Sep 15 16:09:18 on ttys004

lvzhaoiPhone:~ lvzhao$ curl -sSL https://get.rvm.io | bash -s stable

Downloading https://github.com/rvm/rvm/archive/1.29.3.tar.gz

Downloading https://github.com/rvm/rvm/releases/download/1.29.3/1.29.3.tar.gz.asc

Found PGP signature at: 'https://github.com/rvm/rvm/releases/download/1.29.3/1.29.3.tar.gz.asc',

but no GPG software exists to validate it, skipping.


Upgrading the RVM installation in /Users/lvzhao/.rvm/

    RVM PATH line found in /Users/lvzhao/.mkshrc /Users/lvzhao/.profile /Users/lvzhao/.bashrc /Users/lvzhao/.zshrc.

    RVM sourcing line found in /Users/lvzhao/.profile /Users/lvzhao/.bash_profile /Users/lvzhao/.zlogin.

Upgrade of RVM in /Users/lvzhao/.rvm/ is complete.


Upgrade Notes:


  * No new notes to display.


lvzhaoiPhone:~ lvzhao$ rvm -v

rvm 1.29.3 (latest) by Michal Papis, Piotr Kuczynski, Wayne E. Seguin [https://rvm.io]

lvzhaoiPhone:~ lvzhao$ rvm get stable

Downloading https://get.rvm.io

No GPG software exists to validate rvm-installer, skipping.

Downloading https://github.com/rvm/rvm/archive/1.29.3.tar.gz

Downloading https://github.com/rvm/rvm/releases/download/1.29.3/1.29.3.tar.gz.asc

curl: (28) Connection timed out after 30001 milliseconds


Could not download 'https://github.com/rvm/rvm/releases/download/1.29.3/1.29.3.tar.gz.asc'.

  curl returned status '28'.



Upgrading the RVM installation in /Users/lvzhao/.rvm/

    RVM PATH line found in /Users/lvzhao/.mkshrc /Users/lvzhao/.profile /Users/lvzhao/.bashrc /Users/lvzhao/.zshrc.

    RVM sourcing line found in /Users/lvzhao/.profile /Users/lvzhao/.bash_profile /Users/lvzhao/.zlogin.

Upgrade of RVM in /Users/lvzhao/.rvm/ is complete.


Upgrade Notes:


  * No new notes to display.


RVM reloaded!

lvzhaoiPhone:~ lvzhao$ rvm list known

# MRI Rubies

[ruby-]1.8.6[-p420]

[ruby-]1.8.7[-head] # security released on head

[ruby-]1.9.1[-p431]

[ruby-]1.9.2[-p330]

[ruby-]1.9.3[-p551]

[ruby-]2.0.0[-p648]

[ruby-]2.1[.10]

[ruby-]2.2[.7]

[ruby-]2.3[.4]

[ruby-]2.4[.1]

ruby-head


# for forks use: rvm install ruby-head-<name> --url https://github.com/github/ruby.git --branch 2.2


# JRuby

jruby-1.6[.8]

jruby-1.7[.27]

jruby[-9.1.13.0]

jruby-head


# Rubinius

rbx-1[.4.3]

rbx-2.3[.0]

rbx-2.4[.1]

rbx-2[.5.8]

rbx-3[.84]

rbx-head


# Opal

opal


# Minimalistic ruby implementation - ISO 30170:2012

mruby-1.0.0

mruby-1.1.0

mruby-1.2.0

mruby-1[.3.0]

mruby[-head]


# Ruby Enterprise Edition

ree-1.8.6

ree[-1.8.7][-2012.02]


# Topaz

topaz


# MagLev

maglev[-head]

maglev-1.0.0


# Mac OS X Snow Leopard Or Newer

macruby-0.10

macruby-0.11

macruby[-0.12]

macruby-nightly

macruby-head


# IronRuby

ironruby[-1.1.3]

ironruby-head

lvzhaoiPhone:~ lvzhao$ rvm install 2.4.0

Searching for binary rubies, this might take some time.

No binary rubies available for: osx/10.12/x86_64/ruby-2.4.0.

Continuing with compilation. Please read 'rvm help mount' to get more information on binary rubies.

Checking requirements for osx.

Installing requirements for osx.

Updating system.........

Installing required packages: autoconf, automake, libtool, pkg-config, coreutils, libyaml, readline, libksba, openssl@1.1.........

Certificates bundle '/usr/local/etc/openssl@1.1/cert.pem' is already up to date.

Requirements installation successful.

Installing Ruby from source to: /Users/lvzhao/.rvm/rubies/ruby-2.4.0, this may take a while depending on your cpu(s)...

ruby-2.4.0 - #downloading ruby-2.4.0, this may take a while depending on your connection...

  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current

                                 Dload  Upload   Total   Spent    Left  Speed

  9 11.9M    9 1122k    0     0  20959      0  0:09:59  0:00:54  0:09:05 17477



感谢博主:http://www.jianshu.com/p/c073e6fc01f5

安装完成 Ruby

然后继续安装CocoaPods

$pod setup

在终端输入pod setup,会出现Setting up CocoaPods master repo,等几分钟,会输入Setup completed,说明pod setup执行成功。

终端输入:pod search RxSwift(不区分大小写)


输出:Creating search index for spec repo 'master'.. Done!

稍等片刻就会出现所有带RxSwift字段的类库出现。

我等了好久,真的好久


创建一个工程.

然后在终端里面 cd 把你的工程拖进终端, 回车.

然后新建Podfile 文件

$ vim Podfile

终端vim文件 i 可编辑 esc 退出编辑,:wq  可保存退出 (大学学过, 那个时候觉得不重要,学了个皮毛.不过已经够用了)


platform:ios,'7.0'


target 你自己工程的名字 do

pod 'AFNetworking','3.1.0'

pod 'MJExtension'

pod 'ReactiveCocoa'

pod 'SDWebImage','~> 3.7.6'

pod 'MJRefresh'


pod 'UMengAnalytics-NO-IDFA'

pod 'FMDB'

pod 'Reachability'

pod 'Toast'

pod 'SCLAlertView-Objective-C'

pod 'JKCountDownButton'

pod 'IQKeyboardManager', '~> 3.2.2'

pod 'DZNEmptyDataSet'

end


然后导入第三方库

$pod install



打开自己的工程 看到RandomLOL.xcworkspace


  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值