Cocopods安装和升级备忘录

news/2024/7/7 15:09:03

2019独角兽企业重金招聘Python工程师标准>>> hot3.png

这是两个多月前写在mac 备忘录上的一个备忘文档,现在分享出来,希望对新手或者需要的人有帮助

cocopods安装

相关概念解释

Homebrew(brew)

Homebrew(brew) 是macOS上的包管理器,安装命令行工具,详情介绍可以看下面的网址链接
https://github.com/Homebrew/brew
https://brew.sh/

命令行安装brew:
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

Ruby和Gem

Ruby 面向对象的语言

Gem是一个管理Ruby库和程序的标准包,它通过Ruby Gem(如 http://rubygems.org/ )源来查找、安装、升级和卸载软件包,非常的便捷。 Ruby 1.9.2版本默认已安装Ruby Gem

Cocopods

Cocopods是os/osx开发库管理工具,可以使用类似下面的语法配置引入需要用到的第三方库,执行安装命令,Cocopods会自动去下载第三方库并且做好相应的配置,简化了引入第三方库的流程,让开发更简单高效,是iOS开发的必备工具。

platform :ios, '9.0'
inhibit_all_warnings!
source 'https://github.com/CocoaPods/Specs.git'

target 'iosapp' do

pod 'AFOnoResponseSerializer'
pod 'SDWebImage'  , '~>3.8.2'
pod 'YYKit'
pod 'MBProgressHUD'
pod 'TTTAttributedLabel'
pod 'Masonry'
pod 'FMDB'

end

依赖关系

(因为xcode开发工具,他帮我们安装好Unix环境需要的开发包)
Homebrews/Xcode <- RVM <- Ruby <- Cocoapods

安装步骤

I. Homebrew升级

1、brew升级

brew update

可能会报错:Error: /usr/local must be writable!,执行下面的 2~3 步骤解决这个问题
这一步没报错可以跳到 RVM 安装和Ruby安装升级 这个步骤

2、doctor 检查

brew doctor

3、修改权限

sudo chown -R $(whoami) /usr/local

3.1、下载brew

cd "$(brew --repository)" && git fetch && git reset --hard origin/master

4、再次update

brew update

II RVM 安装和Ruby安装升级

RVM (Ruby Version Manager) Ruby的版本管理工具

1、RVM安装

curl -L get.rvm.io | bash -s stable  
source ~/.bashrc  
source ~/.bash_profile  

可能会有红色警告,第2步解决这个问题

In case of problems: https://rvm.io/help and https://twitter.com/rvm_io

  * WARNING: You have '~/.profile' file, you might want to load it,
    to do that add the following line to '/Users/aron/.bash_profile':

      source ~/.profile

2、rvm list known 查看可用的rub版本

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[.6]
[ruby-]2.3[.3]
[ruby-]2.4[.0]
ruby-head

2.1、 打开文件 ~/.bash_profile

vim ~/.bash_profile 

2.2、 最后添加一行

source ~/.profile

3、安装指定版本,我安装的是2.3.0,版本需要是rvm list known上面出现的版本

rvm install 2.3.0

3.1 文档安装

rvm docs generate-ri  //安装文档,可选  

4、查看版本信息

ruby -v
ruby 2.3.0p0 (2015-12-25 revision 53290) [x86_64-darwin16]  

5、ruby源修改

5.0、gem sources -l  //查看源  
5.1、gem sources -r https://rubygems.org/  //移除旧的源  
5.2、gem sources -a https://gems.ruby-china.org/  //添加新的源  

6、Ruby 的其它设置,这部分设置可以省略
http://www.jb51.net/article/70472.htm
切换 Ruby 版本

rvm use 2.2.0  

如果想设置为默认版本,这样一来以后新打开的控制台默认的 Ruby 就是这个版本

rvm use 2.2.0 --default 

查询已经安装的ruby

rvm list

卸载一个已安装版本

rvm remove 1.8.7  

III. cocoapods安装

gem install cocoapods  //安装
pod —version //查看pod的版本  

其他操作

*可以再 ~/.bash_profile 文件中添加以下内容提供快捷方式更新pod库

alias podupn="pod _1.1.1_ update --no-repo-update"  
alias podup="pod _1.1.1_ update"  

*16. 解决Unable to find a pod with name, author, summary, or description matching AFNetworking错误:

rm ~/Library/Caches/CocoaPods/search_index.json  

*查看repos文件夹下面所有文件的大小

arondeMac-mini:repos arons$ pwd  
/Users/arons/.cocoapods/repos  
arondeMac-mini:repos arons$ du -sh *  
 10M	flspecs  
915M	master  
arondeMac-mini:repos arons$   

升级cocoapods命令

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

删除本地的缓存

sudo rm -fr ~/.cocoapods/repos/master  
pod setup  

本地缓存

/Users/aron/Library/Caches/CocoaPods/Pods/Release/  

错误QA

具体报错

fatal: The remote end hung up unexpectedly  
error: RPC failed; curl 18 transfer closed with outstanding read data remaining
  

解决方法

git config --global http.postBuffer 524288000

转载于:https://my.oschina.net/FEEDFACF/blog/1480211


http://www.niftyadmin.cn/n/4610646.html

相关文章

layui table中 field参数

一、 layui table中 field参数是个对象&#xff0c;点不出来 解决&#xff1a; 在实体类中增加get方法 二、field参数判断后台的值进行显示

crontab文件的真实位置

Linux在相应用户下&#xff0c;用crontab &#xff0d;l 命令可以查看该用户定时执行的任务&#xff0c;-e可以编辑&#xff0c;但是其真实文件在哪儿呢&#xff1f;&#xff1f;以CentOS为例&#xff0c;其真实的位置在&#xff1a;/var/spool/cron下面&#xff0c;有执行定时…

关于Oracle中sysoper这个系统权限的问题

我们都知道Oracle数据库安装完之后。默认的会有这样几个系统角色或权限。nomal,sysdba,sysoper等等&#xff0c;之前每次登录Oracle的时候。都是直接以conn / as sysdba 的身份登录的。可是一直都不知道sysoper是用来干嘛的&#xff0c;仅仅知道是个系统操作员。 然后&#xff…

HBase 1、HBase介绍和工作原理

HBase是一个分布式的、面向列的开源数据库&#xff0c;该技术来源于 Fay Chang 所撰写的Google论文“Bigtable&#xff1a;一个结构化数据的分布式存储系统”。就像Bigtable利用了Google文件系统&#xff08;File System&#xff09;所提供的分布式数据存储一样&#xff0c;HBa…

freemark里面设置一个单选框,根据后台的值进行回选

freemark里面设置一个单选框&#xff0c;根据后台的值进行回显 <input type"radio" name"provisional" <#if sopInfo.provisional false>checked</#if> value"0" class"layui-input" title"否"><in…

Linux set命令详解:开启,关闭shell功能属性

set是一个shell内部命令&#xff0c;用于开启或关闭shell功能属性&#xff0c;如果什么都不加&#xff0c;则直接显示用户自定义变量和环境变量语法&#xff1a;set [选项...]选项&#xff1a;-f&#xff1a;禁用通配符f&#xff1a;启用通配符-u&#xff1a;如果脚本中有未设置…

【BZOJ 1997】[Hnoi2010]Planar

Description Input Output 找到哈密尔顿环之后找到不在哈密尔顿环上的边这些边如果同时在里面相交那他们同时在外面也相交&#xff0c;所以只能一外一内&#xff0c;这就变成了2-SAT&#xff0c;判一下就好了平面图性质 边数<3*n-61 #include<cstdio>2 #include<cs…

将输入框中的值赋值给下拉框

当触发光标移除或者回车事件的时候 将输入框中的值赋值给layui下拉框, 下拉框是动态赋值&#xff0c;记得刷新 layui.form.render(select); <form class"layui-form layui-col-space5" id"search_menu">//下拉框<div class"layui-inline l…