总述:需要的安装的插件:(通过终端安装) :fastlane,Xcode 命令行工具,pgyer;
步骤:
1:安装fastlane
1)首先要安装正确的 Ruby 版本,在终端窗口中用下列命令来确认:
ruby -v
终端反应:
macdeMacBook-Air:Desktop mac$ ruby -v
ruby 2.3.3p222 (2016-11-21 revision 56859) [universal.x86_64-darwin17]
2)然后检查 Xcode 命令行工具是否安装。在终端窗口中输入命令:
xcode-select --install
如果未安装,终端会开始安装,如果报错误:command line tools are already installed, use "Software Update" to install updates.代表已经安装。
终端反应:
macdeMacBook-Air:Desktop mac$ xcode-select --install
xcode-select: error: command line tools are already installed, use "Software Update" to install updates
3)以上依赖配置好之后就可以通过 rubygem 进行安装了:
$ sudo gem install fastlane
Password: //输入电脑密码
Fetching: slack-notifier-2.3.2.gem (100%)
Successfully installed slack-notifier-2.3.2
Fetching: rouge-2.0.7.gem (100%)
Successfully installed rouge-2.0.7
Fetching: xcpretty-0.3.0.gem (100%)
...
...
...
... //安装很多东西
53 gems installed
$
如果安装出现以下错误:
$ sudo gem install fastlane
Password:
ERROR: SSL verification error at depth 1: self signed certificate in certificate chain (19)
ERROR: Root certificate is not trusted (/CN=PH01.COM)
ERROR: SSL verification error at depth 1: self signed certificate in certificate chain (19)
ERROR: Root certificate is not trusted (/CN=PH01.COM)
ERROR: SSL verification error at depth 1: self signed certificate in certificate chain (19)
ERROR: Root certificate is not trusted (/CN=PH01.COM)
ERROR: Could not find a valid gem 'fastlane' (>= 0), here is why:
Unable to download data from https://rubygems.org/ - SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed (https://rubygems.org/specs.4.8.gz)
出现这个问题的原因主要是Ruby环境需要2.2版本以上,所以要更新Ruby环境。
更新Ruby环境
0.首先要安装Homebrew终端输入这条命令即可/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
1.安装rvm$ curl -L get.rvm.io | bash -s stable
2.装载rvm$ source ~/.rvm/scripts/rvm
3.安装2.3.0版本ruby$ rvm install 2.3.0
4.将2.3.0设为默认$ rvm use 2.3.0 --default
更新完之后再执行sudo gem install fastlane 安装就可以安装成功了