文章目录
  1. 1. MacOS安装Cocoapods步骤

MacOS安装Cocoapods步骤

MacOS安装Cocoapods步骤

MAY 27TH, 2013 | COMMENTS

Cocoapods本身就是ruby的一个gem,所以没啥特殊的安装方式,但是很多iOS或者OSX开发人员都对ruby不熟悉,所以简单的总结一下。

分为一下几步骤:

** 1. 安装Command Line Tool (CLT)**

2. 安装Homebrew

3. 安装rvm

4. 安装ruby

5. 安装cocoapods

好像要装不少东西……其实都是一层一层的,CLT是必装的,homebrew管理一些依赖,rvm实现ruby虚拟机。已经安装有的可以跳过,也可以重新按照上面的步骤安装。

请先确保XCODE为最新版本!!!

安装Command Line Tool (CLT)

在Xcode的Preferences–>Downloads–>Components里面可以直接安装,也可以到Apple单独下载安装。

MacOSX 10.9 系统下,还需要执行命令行xcode-select –install!

安装Homebrew

1

$ ruby -e “$(curl -fsSL
https://raw.github.com/mxcl/homebrew/go/install)”

安装完成之后,执行诊断,检查是否有异常

1

$ brew doctor

正常是不会有问题的,如果提示存在旧版本的XCODE,最好删除,否则容易混乱CLT。

接下来执行:

1

2

$ brew update

$ brew tap homebrew/dupes

安装rvm

1

$ \curl -L https://get.rvm.io | bash -s stable –autolibs=enable

很慢,如果你是第一次装的话,要装各种依赖……

安装ruby

选择合适的ruby版本,选择cocoapods比较兼容的版本装,例如装2.0版本:

1

$ rvm install 2.0

安装cocoapods

1

$ gem install cocoapods

完工!

\

\

\

\

\

Q:Pod install is staying on “Setting up
Cocoapods Master repo”

**
**

**
**

I’m cloning a project from a git repo,
but when I execute pod install the first line I see is “Setting up
Cocoapods Master repo” and after that I can’t see anything more, the
console stop there.

**
**

I don’t know what is happening. Anyone
knows what’s happening here? Why cocoapods stops there?.

\

The issue is that you haven’t got
command line tools installed, I believe. Try run in terminal:

**
**

sudo gem update —system

after that download command line tools
from Apple just search for ‘Command Line Tools’ and download the right
version for your OS. Once you install it run in terminal:

**
**

sudo gem install cocoapods

pod setup

**
**

done!!

\

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

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

\

pod install –no-repo-update


update cocoapods

sudo gem update

文章目录
  1. 1. MacOS安装Cocoapods步骤