cocoapods安装的大坑

当你按现有的顺序安装cocoapods的时候

1.移除现有的Ruby

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

2.使用淘宝镜像

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

3.验证当前ruby版本

$gem sources -l

成功后提示:

*** CURRENT SOURCES ***

https://ruby.taobao.org/

4.开始安装cocoapods

$sudo gem install cocoa pods

这时候会出现提示,需要你升级Ruby

使用ruby -v查看你现有的版本

结果是:ruby 2.0.0p648 (2015-12-16 revision 53162) [universal.x86_64-darwin15]

使用ruby list known查看ruby所有版本

如果提示command not found 请先安装rvm

curl -L get.rvm.io | bash -s stable(安装ram命令)


查看ruby版本后发现我们的版本确实太低了,这时候终端输入rvm install 2.2.2

如果出现这种错误:

Searching for binary rubies, this might take some time.

Found remote file https://rvm_io.global.ssl.fastly.net/binaries/osx/10.11/x86_64/ruby-2.2.2.tar.bz2

Checking requirements for osx.

Installing requirements for osx.

Updating system.........

Error running 'requirements_osx_brew_update_system ruby-2.2.2',

showing last 15 lines of /Users/chuanchunli/.rvm/log/1473597554_ruby-2.2.2/update_system.log

https://github.com/Homebrew/homebrew/wiki/Common-Issues

and make sure `brew update` works before continuing.'

++ rvm_pretty_print stderr

++ case "${rvm_pretty_print_flag:=auto}" in

++ case "${TERM:-dumb}" in

++ case "$1" in

++ [[ -t 2 ]]

++ return 1

++ printf %b 'Failed to update Homebrew, follow instructions here:

https://github.com/Homebrew/homebrew/wiki/Common-Issues

and make sure `brew update` works before continuing.\n'

Failed to update Homebrew, follow instructions here:

https://github.com/Homebrew/homebrew/wiki/Common-Issues

and make sure `brew update` works before continuing.

++ return 1

Requirements installation failed with status: 1.


不要着急,下面告诉大家怎么做,本人在这里卡了一天

终端输入

brew doctor

错误提示:

Please note that these warnings are just used to help the Homebrew maintainers

with debugging if you file an issue. If everything you use Homebrew for is

working fine: please don't worry and just ignore them. Thanks!

Warning: The following directories are not writable:

/usr/local/share/man

This can happen if you "sudo make install" software that isn't managed

by Homebrew. If a formula tries to write a file to this directory, the

install will fail during the link step.

You should change the ownership and permissions of these directories.

back to your user account.

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

Warning: You have unlinked kegs in your Cellar

Leaving kegs unlinked can lead to build-trouble and cause brews that depend on

those kegs to fail to run properly once built. Run `brew link` on these:

autoconf

libgpg-error

libtool

pig-config

在输入

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

然后输入

brew link autoconf

brew link libgpg-error

brew link libtool

brew link pig-config

最后再次输入rvm install 2.2.2

这回就应该可以安装cocoapods了

安装cocoa pods命令:sudo gem install cocoapods

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容