美文网首页
解决macOS升级10.13(HighSierra)之后fast

解决macOS升级10.13(HighSierra)之后fast

作者: botherbox | 来源:发表于2017-12-07 14:54 被阅读323次

最近升级了macOS High Sierra(10.13),升级时间挺长,不过倒是没有出现网上说的各种问题,软件啥的都正常使用。
不过,fastlane和cocoapods却不能用了:

fastlane 和 pod 均报同样的错:

$ fastlane beta
zsh: /usr/local/bin/fastlane: bad interpreter: /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin: no such file or directory
$ pod
zsh: /usr/local/bin/pod: bad interpreter: /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin: no such file or directory

通过 cat `which pod`命令可以查看pod命令的代码

$ cat `which pod`

#!/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby
#
# This file was generated by RubyGems.
#
# The application 'cocoapods' is installed as part of a gem, and
# this file is here to facilitate running it.
#

require 'rubygems'

version = ">= 0.a"

if ARGV.first
  str = ARGV.first
  str = str.dup.force_encoding("BINARY") if str.respond_to? :force_encoding
  if str =~ /\A_(.*)_\z/ and Gem::Version.correct?($1) then
    version = $1
    ARGV.shift
  end
end

load Gem.activate_bin_path('cocoapods', 'pod', version)

原来是因为macOS升级10.13之后升级了ruby版本,从原来的2.0升级到了2.3,结果这些通过ruby的解释的程序都找不到ruby解释器了

那顺着这条线索,我先升级一下fastlanepod是不是就好了呢🤔️?

  1. 我的fastlanecocoapods都是通过gem安装的
  2. gem呢又是通过brew安装的

所以,想通过gem升级一下fastlanepod

$ sudo gem install fastlane

结果却报错了🤔️:

ERROR:  While executing gem ... (TypeError)
    no implicit conversion of nil into String

google了一下,说先升级一下gem

$ sudo gem update --system

Updating rubygems-update
ERROR:  While executing gem ... (TypeError)
    no implicit conversion of nil into String

结果依然是报同样的错误

猜想难道是brew的问题🤔️?于是升级了brew

$ brew update

结果brew升级完了再升级gem也还是同样的错误。

又google了一下,结果搜到了官方的issue,里面有人回复称这样操作:

# 先删除 update_rubygems
$ rm /usr/local/bin/update_rubygems

# 然后再更新 gem到2.6.2版本
$ gem update -N --system 2.6.2

删除update_rubygems之后再更新gem就不会报刚才的错误了。
然后再重新安装 fastlanepod

$ sudo gem install fastlane
$ sudo gem install cocoapods

🎉然后就又能愉快的使用了✌️

相关文章

网友评论

      本文标题:解决macOS升级10.13(HighSierra)之后fast

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