前言,鑒於很多人都比較趕時間,有人是為了去應付工作,有人是為了去找妹子,總之,不管你懂不懂,如果你只是想安裝一下,那麼你只需要按照濤叔下面畫黃色的命令複製粘貼到終端順序執行就好了。

一、安裝

1、Ruby环境搭建

1.1查看下当前ruby版本:打开终端输入 ruby -v

$ ruby -v

libotaodeMacBook-Pro:~ libotao$ ruby -v
ruby 2.0.0p481 (-- revision ) [universal.x86_64-darwin14]

1.2更新ruby (濤叔在此並沒有更新,如果後續安裝工作失敗,請執行下列更新命令。)跟新方法如下

#查看当前ruby版本
$ ruby -v
ruby 1.8.
#列出已知的ruby版本
$ rvm list known
#安装ruby 1.9.
$ rvm install 1.9.

2. 安裝cocoapods

通过淘宝的镜像来访问cocoapods    在天朝,由于cocoapods.org被墙,我们可以使用淘宝的ruby镜像来访问

sudo gem sources -a http://ruby.taobao.org/

libotaodeMacBook-Pro:~ libotao$ sudo gem sources -a http://ruby.taobao.org/
Password:
http://ruby.taobao.org/ added to sources

sudo gem sources -r https://rubygems.org/

libotaodeMacBook-Pro:~ libotao$ sudo gem sources -r https://rubygems.org/
Password:
https://rubygems.org/ removed from sources

gem sources –l      (用该命令查看ruby镜像是否是taobao)

libotaodeMacBook-Pro:~ libotao$ gem sources –l
*** CURRENT SOURCES *** http://ruby.taobao.org/

sudo gem install cocoapods

libotaodeMacBook-Pro:~ libotao$ sudo gem install cocoapods
Fetching: i18n-0.7..gem (%)
Successfully installed i18n-0.7.
Fetching: thread_safe-0.3..gem (%)
Successfully installed thread_safe-0.3.
Fetching: tzinfo-1.2..gem (%)
Successfully installed tzinfo-1.2.
Fetching: minitest-5.6..gem (%)
Successfully installed minitest-5.6.
Fetching: activesupport-4.2..gem (%)
Successfully installed activesupport-4.2.
Fetching: nap-0.8..gem (%)
Successfully installed nap-0.8.
Fetching: fuzzy_match-2.0..gem (%)
Successfully installed fuzzy_match-2.0.
Fetching: cocoapods-core-0.36..gem (%)
Successfully installed cocoapods-core-0.36.
Fetching: claide-0.8..gem (%)
Successfully installed claide-0.8.
Fetching: colored-1.2.gem (%)
Successfully installed colored-1.2
Fetching: xcodeproj-0.23..gem (%)
Successfully installed xcodeproj-0.23.
Fetching: cocoapods-downloader-0.9..gem (%)
Successfully installed cocoapods-downloader-0.9.
Fetching: cocoapods-plugins-0.4..gem (%)
Successfully installed cocoapods-plugins-0.4.
Fetching: cocoapods-try-0.4..gem (%)
Successfully installed cocoapods-try-0.4.
Fetching: netrc-0.7..gem (%)
Successfully installed netrc-0.7.
Fetching: cocoapods-trunk-0.6..gem (%)
Successfully installed cocoapods-trunk-0.6.
Fetching: molinillo-0.2..gem (%)
Successfully installed molinillo-0.2.
Fetching: escape-0.0..gem (%)
Successfully installed escape-0.0.
Fetching: open4-1.3..gem (%)
Successfully installed open4-1.3.
Fetching: cocoapods-0.36..gem (%)
Successfully installed cocoapods-0.36.
Parsing documentation for i18n-0.7.
Installing ri documentation for i18n-0.7.
Parsing documentation for thread_safe-0.3.
Installing ri documentation for thread_safe-0.3.
Parsing documentation for tzinfo-1.2.
Installing ri documentation for tzinfo-1.2.
Parsing documentation for minitest-5.6.
Installing ri documentation for minitest-5.6.
Parsing documentation for activesupport-4.2.
unable to convert "\x84" from ASCII-8BIT to UTF- for lib/active_support/values/unicode_tables.dat, skipping
Installing ri documentation for activesupport-4.2.
Parsing documentation for nap-0.8.
Installing ri documentation for nap-0.8.
Parsing documentation for fuzzy_match-2.0.
Installing ri documentation for fuzzy_match-2.0.
Parsing documentation for cocoapods-core-0.36.
Installing ri documentation for cocoapods-core-0.36.
Parsing documentation for claide-0.8.
Installing ri documentation for claide-0.8.
Parsing documentation for colored-1.2
Installing ri documentation for colored-1.2
Parsing documentation for xcodeproj-0.23.
Installing ri documentation for xcodeproj-0.23.
Parsing documentation for cocoapods-downloader-0.9.
Installing ri documentation for cocoapods-downloader-0.9.
Parsing documentation for cocoapods-plugins-0.4.
Installing ri documentation for cocoapods-plugins-0.4.
Parsing documentation for cocoapods-try-0.4.
Installing ri documentation for cocoapods-try-0.4.
Parsing documentation for netrc-0.7.
Installing ri documentation for netrc-0.7.
Parsing documentation for cocoapods-trunk-0.6.
Installing ri documentation for cocoapods-trunk-0.6.
Parsing documentation for molinillo-0.2.
Installing ri documentation for molinillo-0.2.
Parsing documentation for escape-0.0.
Installing ri documentation for escape-0.0.
Parsing documentation for open4-1.3.
Installing ri documentation for open4-1.3.
Parsing documentation for cocoapods-0.36.
Installing ri documentation for cocoapods-0.36.
gems installed

設置:將第三方框架在本地進行一些設置

$pod setup

pod setup命令执行后原理是将Spec项目复制到当前用户的.cocoapods\master目录下,以后的查找、安装使用都是基于该本地目录的.

安装成功后,就可以尝试使用了,以后更新新版本的Spec项目只需要再次执行pod setup即可

 libotaodeMacBook-Pro:~ libotao$ pod setup
Setting up CocoaPods master repo
Setup completed

关于Spec

简单的说,Spec就是每个包在CocoaPods中的配置文件,其中包括Package的名字,版本号,每个版本对应的下载地址,编译时的参数等等。

这是该项目的地址:https://github.com/CocoaPods/Specs

在页面上有介绍如何创新新的包,可以Fork该项目,然后通过pull request提交所建的新包。

附上一篇详细的教程

http://ishalou.com/blog/2012/10/16/how-to-create-a-cocoapods-spec-file/

二、查看你是否安裝成功

$pod

libotaodeMacBook-Pro:~ libotao$ pod
Usage: $ pod COMMAND CocoaPods, the Cocoa library package manager. Commands: + init Generate a Podfile for the current directory.
+ install Install project dependencies to Podfile.lock versions
+ ipc Inter-process communication
+ lib Develop pods
+ list List pods
+ outdated Show outdated project dependencies
+ plugins Show available CocoaPods plugins
+ repo Manage spec-repositories
+ search Searches for pods
+ setup Setup the CocoaPods environment
+ spec Manage pod specs
+ trunk Interact with the CocoaPods API (e.g. publishing new specs)
+ try Try a Pod!
+ update Update outdated project dependencies and create new
Podfile.lock Options: --silent Show nothing
--version Show the version of the tool
--verbose Show more debugging information
--no-ansi Show output without ANSI codes
--help Show help banner of specified command

三、安裝插件

curl -fsSL https://raw.github.com/supermarin/Alcatraz/master/Scripts/install.sh | sh

github 地址:https://github.com/supermarin/Alcatraz

或者下載Alcatraz 直接用XCode運行即可安裝。在這裡可以管理第三方插件。在下面搜CocoaPods并安裝可以省卻命令行操作。

MAC安裝CocoaPods的更多相关文章

  1. MAC安裝《Genymotion Android模擬器》大玩Android APP (神魔之塔)

    链接地址:http://www.minwt.com/mac/10083.html/comment-page-2 MAC» 智慧型裝罝» Android | 2014/02/12 Android是一個開 ...

  2. 安裝 Rails 開發環境

    安裝 Rails 開發環境 Give someone a program, you frustrate them for a day; teach them how to program, you f ...

  3. MyEclipse 2014 for Mac 在Yosemite怎樣安裝

    相信大家都在安裝MyEclipse 2014 for Mac時候會遇到提示虚拟内存为0,,无法安装...小弟找了解決方法...1. 先下載軟件及破解檔案.   http://pan.baidu.com ...

  4. mac os安裝jdk

    下載安裝 打开mac笔记本,输入账号密码登陆后,点击桌面上的terminal终端图标.打开终端,然后在终端中输入命令java.   从下面的图中可以看到,终端会自动给出提示,没有可以使用的java命令 ...

  5. 如何在 Mac上 安裝 .NET Core 2.1 ?

    一.前言 Free. Cross-platform. Open source. A developer platform for building all your apps. --- .net co ...

  6. 【转】什麼是 Team Explorer Everywhere 2010 ?TFS 專用的 Eclipse 整合套件的安裝與設定

    前言- 大家都知道 版本管控是一件很重要的事情!而且也知道分別有 VSS , SVN , TFS 等- 多數人都會覺得, .NET 的開發工具要用 VSS . TFS .SVN 而 Java 的 Ec ...

  7. 在VPS上安裝BT軟體Transmission

    在VPS上安裝BT軟體Transmission   作者: 窮苦人家的小孩 | 2009-12-04 55 Comments   VPS 還能怎玩?! 裝Proxy,裝VPN,這還不夠,我還用來掛種子 ...

  8. Gazebo機器人仿真學習探索筆記(一)安裝與使用

    Gazebo提供了多平臺的安裝和使用支持,大部分主流的linux,Mac以及Windows,這裏結合ROS以Ubuntu爲例進行介紹. 首先是參考資料:http://gazebosim.org/tut ...

  9. PHP 7.0 5.6 下安裝 phpLDAPadmin 发生错误的修正方法

    在稍具規模的網路環境中, 網管時常選用 LDAP 來進行帳號的統整管理, 一方面提供管理便利度, 另一方面使用者也不必因為不同系統而記憶不同帳號, phpLDAPadmin 是一套常見的 LDAP 管 ...

随机推荐

  1. js显示yyyy年mm日dd天 星期几 的格式日期

    js代码: <script type="text/javascript"> var today = new Date(); var week; //存储星期几 var ...

  2. 每天一个linux命令(33):df 命令

    linux中df命令的功能是用来检查linux服务器的文件系统的磁盘空间占用情况.可以利用该命令来获取硬盘被占用了多少空间,目前还剩下多少空间等信息. 1.命令格式: df [选项] [文件] 2.命 ...

  3. Oracle SQL 优化原则(实用篇)

    由于SQL优化优化起来比较复杂,并且还受环境限制,在开发过程中,写SQL必须遵循以下几点原则: 1.Oracle 采用自下而上的顺序解析WHERE子句,根据这个原理,表之间的连接必须写在其他Where ...

  4. SQL优化快速入门

    最近遇到一个专门进行SQL技术优化的项目,对很多既有的老存储过程进行调优(现在已经不再新增任何存储过程),因此系统的对SQL语句编写进行一次科学的学习变得很有必要.这儿将基于黄德承大神的Oracle ...

  5. css 用direction来改变元素水平方向,价值研究。

    "direction"有两个值:ltr | rtl ltr:从左往右 rtl:从右往左 默认:ltr 一起看个效果就懂了. <style> div{ direction ...

  6. 栈-java代码

    import java.util.Arrays; public class StackDemo { private int maxSize; private long[] stackArray; pr ...

  7. Android基于mAppWidget实现手绘地图(十六)–处理一次触摸多个地图对象

    最好的处理方式就是弹出一个对话框,将用户触摸过的控件罗列出来.你可以通过实现OnMapTouchListener来处理. 参考以下代码,实现上述功能: mapWidget.setOnMapTouchL ...

  8. [转载]—— Android JNI知识点

    Java Native Interface (JNI)标准是java平台的一部分,它允许Java代码和其他语言写的代码进行交互.JNI 是本地编程接口,它使得在 Java 虚拟机 (VM) 内部运行的 ...

  9. 从零开始学习jQuery (一) 入门篇

    本系列文章导航 从零开始学习jQuery (一) 入门篇 一.摘要 本系列文章将带您进入jQuery的精彩世界, 其中有很多作者具体的使用经验和解决方案,  即使你会使用jQuery也能在阅读中发现些 ...

  10. 使用ajax和js无刷新改变页面内容和地址栏URL

    发现一个可以改变地址栏,而不导致页面刷新的东东. Chrome, FF测试通过,不支持IE. 实现目标 页面的跳转(前进后退,点击等)不重新请求页面 页面URL与页面展现内容一致(符合人们对传统网页的 ...