美文网首页
cocoapods升级需要升级ruby brew Xcode 遇

cocoapods升级需要升级ruby brew Xcode 遇

作者: 志闲真人 | 来源:发表于2017-10-19 17:08 被阅读0次

    最近因为pod search 无法查询到最新第三方库,需要更有cocoapods。记录过程遇到的问题。

    1. 首先安装 pod执行sudo gem installcocoapods。

    报错

    ERROR:Error installing cocoapods:

    activesupport requires Ruby version >= 2.2.2.

    提示Ruby版本过低,需要升级Ruby

    2.升级Ruby

    2.1 查看Ruby版本 

    ruby -v

    ruby 2.0.0p648 (2015-12-16 revision 53162) [universal.x86_64-darwin15] 确实版本过低。

    2.2 升级Ruby 需要安装rvm

    如果已经安装可以忽略。

    没有安装需要执行以下命令

    curl -L get.rvm.io | bash -s stable

    source ~/.bashrc

    source ~/.bash_profile

    检测是否安装成功 rvm -v

    输出 rvm 1.29.3 (master) by Michal Papis, Piotr Kuczynski, Wayne E. Seguin [https://rvm.io].即可

    2.3 查看可以安装ruby版本 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[.8]

    [ruby-]2.3[.5]

    [ruby-]2.4[.2]

    [ruby-]2.5[.0-preview1]ruby-head# for forks use: rvm install ruby-head---url https://github.com/github/ruby.git --branch 2.2

    # JRuby

    jruby-1.6[.8]

    jruby-1.7[.27]

    jruby[-9.1.13.0]

    jruby-head

    # Rubinius

    rbx-1[.4.3]

    rbx-2.3[.0]

    rbx-2.4[.1]

    rbx-2[.5.8]

    rbx-3[.86]

    rbx-head

    # Opal

    opal

    # Minimalistic ruby implementation - ISO 30170:2012

    mruby-1.0.0

    mruby-1.1.0

    mruby-1.2.0

    mruby-1[.3.0]

    mruby[-head]

    # Ruby Enterprise Edition

    ree-1.8.6

    ree[-1.8.7][-2012.02]

    # Topaz

    topaz

    # MagLev

    maglev[-head]

    maglev-1.0.0

    # Mac OS X Snow Leopard Or Newer

    macruby-0.10

    macruby-0.11

    macruby[-0.12]

    macruby-nightly

    macruby-head

    # IronRuby

    ironruby[-1.1.3]

    ironruby-head

    2.4 安装最新的是rvm install ruby-head---url

    报错404 可能和网络相关无奈只好尝试其他版本。

    rvm install 2.4.2

    报错

    'Failed to update Homebrew, follow instructions here

    XXXX

    Requirements installation failed with status: 1.

    提示 需要升级brew。

    3.升级brew

    执行 brew update

    报错基本是一些权限问题,修改文件权限即可。

    执行成功查看版本brew --version

    Homebrew 1.3.5

    Homebrew/homebrew-core (git revision a75a9; last commit 2017-10-16)

    4.重新安装Ruby

    rvm install 2.4.2

    4.1报错:error: RPC failed; curl 56 SSLRead() return error -36

    一般原因是因为装了多个Xcode造成的

    卸载,安装最新xcode即可或者执行

    sudo xcode-select-switch/Applications/Xcode.app/Contents/Developer也可。

    再次执行rvm install 2.4.2

    4.2报错:Library not loaded: /usr/local/opt/openssl@1.1/lib/libssl.1.1.dylib (LoadError)

    卸载 ruby   rvm uninstall 2.4.2

    重新安装 rvm reinstall 2.4.2 (很重要)。

    4.3再次报错

    *** Following extensions failed to configure:

    ../.././ext/gdbm/extconf.rb:0: Failed to configure gdbm. It will not be installed.

    *** Fix the problems, then remove these directories and try again if you want.

    make[2]: `ruby' is up to date.

    making enc

    make[1]: Nothing to be done for `enc'.

    making trans

    make[1]: Nothing to be done for `./enc/trans'.

    making encs

    make[1]: Nothing to be done for `encs'.

    ./miniruby -I./lib -I. -I.ext/common  ./tool/runruby.rb --extout=.ext  -- --disable-gems -r./x86_64-darwin16-fake ./tool/rbinstall.rb --make="/Applications/Xcode.app/Contents/Developer/usr/bin/make" --dest-dir="" --extout=".ext" --mflags="" --make-flags="" --data-mode=0644 --prog-mode=0755 --installed-list .installed.list --mantype="doc"

    installing binary commands:  /Users/jeff/.rvm/rubies/ruby-2.4.2/bin

    dyld: lazy symbol binding failed: Symbol not found: _utimensat

    Referenced from: /Users/jeff/.rvm/src/ruby-2.4.2/libruby.2.4.2.dylib

    Expected in: /usr/lib/libSystem.B.dylib

    dyld: Symbol not found: _utimensat

    Referenced from: /Users/jeff/.rvm/src/ruby-2.4.2/libruby.2.4.2.dylib

    Expected in: /usr/lib/libSystem.B.dylib

    make: *** [do-install-nodoc] Abort trap: 6

    ++ return 2

    卸载重新安装试了多次无效。最后尝试是XCode不是最新原因

    可以安装最新Xcode如果还是不行,可以执行以下命令

    brew install rbenv ruby-build

    sudo xcode-select --install

    4.4 重新安装 rvm reinstall 2.4.2 终于成功。

    查看版本 ruby -v

    ruby 2.4.2p198 (2017-09-14 revision 59899) [x86_64-darwin16]

    5 最后安装pod即可 执行

    sudo gem install cocoapods

    5.1 gem source -r https://ruby.taobao.org/ (淘宝资源不能用)

    增加新的资源地址

    gem source -a https://gems.ruby-china.org/

    pod setup 等待即可

    相关文章

      网友评论

          本文标题:cocoapods升级需要升级ruby brew Xcode 遇

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