pod install abort完美解决方案

版权声明:知识版权是属于全人类的! 欢迎评论与转载!!! https://blog.csdn.net/zhuge1127/article/details/82078151

背景:
更新了系统10.12.6,xcode9,iOS11.0.1
报错:pod install abort
解决逆推:需要升级Ruby版本到2.2.2;需要升级Homebrew版本(卸载重装);需要升级Commend Line Tools;

步骤1:安装HomeBrew/卸载更新

#为什么要更新HomeBrew?
报错1:
Error: /usr/local is not writable. You should change the
ownership and permissions of /usr/local back to your
Running Homebrew as root is extremely dangerous and no longer supported.
As Homebrew does not drop privileges on installation you would be giving all
build scripts full access to your system.

报错2:
Error running 'Requirements_oxs_brew_update_system ruby -2.3.3',
showing last 15 lines of /User/Lihongyuan/.rvm/log/848784602_ruby-2.3.3/update system.log
Requirements installation failed with status: 1.

报错3:
Error installing pods:active support requires Ruby version >= 2.2.2
sudo chown -R $(whoami) /usr/local
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/uninstall)"
cd /usr/local
git remote set-url origin git://mirrors.tuna.tsinghua.edu.cn/homebrew.git
cd ~
mkdir tmp
cd tmp
git clone git://mirrors.tuna.tsinghua.edu.cn/homebrew.git
sudo rm -rf /usr/local/.git
sudo rm -rf /usr/local/Library
sudo cp -R homebrew/.git /usr/local/
sudo cp -R homebrew/Library /usr/local/
rm -rf /usr/local/.git
rm -rf /usr/local/Cellar
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
Press RETURN to continue or any other key to abort,请及时回车,并输入密码开始安装

步骤2:更新commend line tools

#安装Ruby版本报错:
Error running '__rvm_make -j 1',
showing last 15 lines of /Users/GDarkness/.rvm/log/1474100434_ruby-2.2.4/make.log

xcode-select --install
报错:Xcode is not currently available from the Software Update server

https://developer.apple.com/download/more/
选择对应系统和xcode版本的tools下载安装

步骤3:更新Ruby
升级 Ruby 环境可以使用 RVM ,也就是 Ruby Version Manager , Ruby 版本管理器。
RVM 包含了 Ruby 的版本管理和 Gem 库管理 (gemset)。RVM 可以让你拥有多个版本的 Ruby,
并且可以在多个版本之间自由切换。

curl -L get.rvm.io | bash -s stable
rvm -v
rvm list known
echo "ruby_url=https://cache.ruby-china.org/pub/ruby" > ~/.rvm/user/db
rvm install 2.2.2 --disable-binary

➜  ~ gem source
*** CURRENT SOURCES ***

http://rubygems-china.oss.aliyuncs.com
➜  ~ rvm current
ruby-2.2.2
➜  ~ rvm list

rvm rubies

   ruby-2.2.0 [ x86_64 ]
=* ruby-2.2.2 [ x86_64 ]

# => - current
# =* - current && default
#  * - default

➜  ~ rvm --default use 2.2.2
Using /Users/yun/.rvm/gems/ruby-2.2.2
#为什么要升级Ruby?
[1] 91225 abort pod install
pod install过程中意外退出,无法生成新的xcworkspace

#为什么要切换:pod无法安装?
/Library/Ruby/Site/2.0.0/rubygems.rb:250:in
 `find_spec_for_exe': can't find gem cocoapods (>= 0.a) (Gem::GemNotFoundException)
    from /Library/Ruby/Site/2.0.0/rubygems.rb:278:in `activate_bin_path'
    from /usr/local/bin/pod:22:in `<main>’

步骤4:安装pods

gem update —system
找一下 pod的路径 
which pod
删除目录下的文件 
sudo rm -rf /usr/local/bin/pod
获取gem:
gem list
删除所有的pod: 
gem uninstall cocoapods -v 0.39.0
gem sources -l
$gem sources --remove https://rubygems.org/
gem sources -a http://rubygems-china.oss.aliyuncs.com
#卸载cocoapods
sudo gem uninstall cocoapods
#安装指定版本
sudo gem install cocoapods --version 1.0.0

步骤5:pod install

#报错信息
diff: /../Podfile.lock: No such file or directory  
diff: Manifest.lock: No such file or directory   
error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.`  

#出现错误
pod install abort

猜你喜欢

转载自blog.csdn.net/zhuge1127/article/details/82078151
今日推荐