Skip to content

Commit f7e15ba

Browse files
committed
new post
1 parent 1da9f3a commit f7e15ba

File tree

1 file changed

+66
-0
lines changed

1 file changed

+66
-0
lines changed
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
---
2+
layout: post
3+
title: CocoaPods 安装和使用 2017.04
4+
subtitle: 安装时间 2017/04/13, 环境macOS 12.10.1, cocoapod版本 1.2.1
5+
date: 2017-04-13
6+
author: BY
7+
header-img: img/post-bg-hacker.jpg
8+
catalog: true
9+
tags:
10+
- iOS
11+
- Xcode
12+
- Cocopods
13+
- ruby
14+
---
15+
16+
# 前言
17+
18+
最近换了新机器,重新搭建了开发环境,其中当然包括 **CocoaPods**
19+
20+
装完顺便更新下 **CocoaPods** 安装文档。
21+
22+
23+
# 正文
24+
25+
CocoaPods是用Ruby实现的,要想使用它首先需要有Ruby的环境。
26+
27+
## 升级ruby
28+
29+
查看ruby版本
30+
$ ruby -v
31+
32+
ruby 2.0.0p648 (2015-12-16 revision 53162) [universal.x86_64-darwin16]
33+
34+
CocoaPods需要**2.2.2**版本及以上的,我们先升级ruby。
35+
36+
使用**rvm**安装ruby
37+
38+
curl -L get.rvm.io | bash -s stable
39+
source ~/.bashrc
40+
source ~/.bash_profile
41+
42+
Ruby的软件源使用亚马逊的云服务被墙了,切换国内的 **ruby-china源**<https://ruby.taobao.org/>已经停止维护,详情[查看公告](https://ruby.taobao.org/)):
43+
44+
$ gem sources --add https://gems.ruby-china.org/ --remove https://rubygems.org/
45+
$ gem sources -l
46+
*** CURRENT SOURCES ***
47+
48+
https://gems.ruby-china.org
49+
到此ruby升级完毕
50+
51+
## 安装CocoaPods
52+
53+
1. 安装
54+
55+
sudo gem install -n /usr/local/bin cocoapods
56+
2. 升级版本库
57+
58+
pod setup
59+
60+
这里需要下载版本库(非常庞大),需要等很久
61+
62+
Receiving objects: 72% (865815/1197150), 150.07 MiB | 190.00 KiB/s
63+
64+
或者直接从其他装有cocoapod的电脑中拷贝`~/.cocoapods`到你的用户目录,然后再 `pod setup`会节省不少时间
65+
66+

0 commit comments

Comments
 (0)