美文网首页iOS开发实践iOS开发新发现iOS 开发之旅
屡试不爽--安装Cocoapods1.1.0最新心得及问题总结!

屡试不爽--安装Cocoapods1.1.0最新心得及问题总结!

作者: RamboLu | 来源:发表于2016-10-10 18:23 被阅读3765次

安装淘宝源就直接跳过,安装十余次,分享下最近安装cocoapods的经验,仅仅提醒ruby版本问题之后的操作.如果还有不懂地方可以下方评论,会及时回答.

Error installing cocoapods:
    activesupport requires Ruby version >= 2.2.2.

1.安装ruby

1>安装 RVM

RVM: Ruby Version Manager, Ruby的版本管理器,包括Ruby的版本管理和Gem库管理(gemset)

curl -L get.rvm.io | bash -s stable
2>安装home-brew(切记先安装home-brew,再安装ruby!!)
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
Homebrew
home-brew地址:<--

如果出现重复安装home-brew,不要怕.

重复安装home-brew

会给你提示命令.
It appears Homebrew is already installed. If your intent is to reinstall you
should do the following before running this installer again:

ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/uninstall)"
3>查询rvm中的ruby版本
rvm list known
4>再安装ruby版本(最新版本2.3.0)
rvm install 2.3.0

出现情况:
1.安装不通过的话可以进行手动安装.


手动安装

Installing requirements for osx.
Updating system.....
Installing required packages: autoconf, automake, libtool, pkg-config, libyaml, readline, libksba, openssl|
........
Error running 'requirements_osx_brew_libs_install autoconf automake libtool pkg-config libyaml readline libksba openssl',
showing last 15 lines of /Users/MTKJ/.rvm/log/1469285314_ruby-2.3.0/package_install_autoconf_automake_libtool_pkg-config_libyaml_readline_libksba_openssl.log

brew install autoconf
brew install automake
brew install lib tool
brew install apple-gcc42
brew install libyaml
brew install libxslt
brew install libksba
brew install openssl

2 . Error running '__rvm_make -j 1' 错误

running '__rvm_make -j 1'

ruby-2.3.0 - #extracting ruby-2.3.0 to /Users/xxxx/.rvm/src/ruby-2.3.0...-
ruby-2.3.0 - #configuring......................................................|
ruby-2.3.0 - #post-configuration.
ruby-2.3.0 - #compiling...........
Error running '__rvm_make -j 1',
showing last 15 lines of /Users/xxxx/.rvm/log/1476689284_ruby-2.3.0/make.log
compiling dln.c
compiling localeinit.c
creating verconf.h
verconf.h updated
compiling loadpath.c
compiling prelude.c
linking static-library libruby.2.3.0-static.a
verifying static-library libruby.2.3.0-static.a
linking shared-library libruby.2.3.0.dylib
generating encdb.h
encdb.h updated
making enc
/bin/sh: /Applications/Xcode: No such file or directory
make: *** [enc] Error 127
++ return 2
There has been an error while running make. Halting the installation.
/Users/xxxx/.rvm/bin/rvm: line 66: shell_session_update: command not found

  • 安装xcode command line 后再次安装ruby.
xcode-select --install
  • 如果还是没有成功,查看自己xcode command line 是否选在正确版本.
Command Line Tools
4>出现错误了,还是没有安装成功ruby.(没关系,卸载RVM,从新安装!)

要记得关闭终端重新打开, 或者打开路径cd ~出现在~

~
sudo rm -rf .rvm .rvmrc   /etc/rvmrc ;gem uninstall rvm

2.安装CocoaPods

1>安装cocoapods(普通版本)
sudo gem install cocoapods
2>更新框架库
pod setup

可以查看框架镜像库的cd ~/.cocoapods

3>更新cocoapods版本(测试版本,仅供特定条件)
sudo gem install cocoapods --pre
4>指定安装cocoapods版本
sudo gem install cocoapods --version 1.0.1

相关文章

网友评论

  • d30cd884f3cf:是切记还是切忌????
  • 若雨千寻:1.0.1 怎么更新到最新?sudo gem install cocoapods --pre 是这个命令么?
    RamboLu:@若雨千寻 sudo gem install cocoapods也是可以的,那个命令是beta版
  • e1e69252eee1:sudo gem install cocoapods --pre
    ERROR: While executing gem ... (Errno::EPERM)
    Operation not permitted - /usr/bin/xcodeproj

    这个错误如何解决
    RamboLu:@yuw 先查看ruby版本是否是2.2以上,不用测试版本,换gem install cocoapods试试.
  • VanChan:艾玛, 回错地方了 :joy:
    RamboLu:@VanChan :smiley:
  • VanChan:不知道楼主有没有解决9.0也无法安装alamofire4.0的问题啊, 不是按文章中另外建项目的方法
  • 远辰jt:老司机 带我飞
    RamboLu:@后知后觉4778 :joy: 想怎么飞

本文标题:屡试不爽--安装Cocoapods1.1.0最新心得及问题总结!

本文链接:https://www.haomeiwen.com/subject/spuwjttx.html