CocoaPods遇到的问题(续)

以前安装CocoaPods文章 传送门
由于CocoaPods经常的更新 出现了一些问题老的文章就就先不改了,这里弄个续试试 遇到的问题希望能帮助大家~
CocoaPods 需要有Ruby进行更新搜索
Ruby版本管理工具有RVM、Brew、Ruby出问题了就得更新 以及安装他的管理工具这样

首先安装rvm
curl -L get.rvm.io | bash -s stable
成功 rvm -v
//进入RVM 环境。
$ source ~/.rvm/scripts/rvm
//查看rvm版本
$ rvm -v
rvm 1.29.9 (latest) by Michal Papis, Piotr Kuczynski, Wayne E. Seguin [https://rvm.io]
$ rvm list
$ brew update
-bash: brew: command not found
又出现个错 记得是brew gem 不行 以前记得弄过  就先试试下面 之后就等待~
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
echo rvm_auto_reload_flag=2>>~/.rvmrc
\curl -sSL https://get.rvm.io | bash -s stable
curl -L get.rvm.io | bash -s stable
rvm reload
等等一些列操作



之后安装Homebrew

/bin/zsh -c "$(curl -fsSL https://gitee.com/cunkai/HomebrewCN/raw/master/Homebrew.sh)"
我选择的第一个源

或者
/bin/bash -c "$(curl -fsSL https://gitee.com/ineo6/homebrew-install/raw/master/install.sh)"

访问此网址:https://brew.idayer.com/
是否成功: brew --version

安装ruby 我安装ruby碰到的问题安装别的安装不了 系统直接锁死2.6
 rvm osx-ssl-certs update /opt/homebrew/etc/openssl@1.1/cert.pem

列出已有的版本:
rvm list known

rvm install "ruby-2.7.1"
rvm install "ruby-2.7.2"
rvm install "ruby-3.0.0"
执行完毕后,查看已安装的ruby
rvm list
设置为使用版本 以及系统默认版本:
rvm use 2.7.2 --default 

ruby -v

brew install cocoapods

sudo gem install -n /usr/local/bin cocoapods -v 1.8.3

 $ /usr/local/bin/git -C /Users/LXS/.cocoapods/repos/master fetch origin
  --progress
  fatal: unable to access 'https://github.com/CocoaPods/Specs.git/': LibreSSL SSL_read: SSL_ERROR_SYSCALL, errno 54
[!] CocoaPods was not able to update the `master` repo. If this is an unexpected issue and persists you can inspect it running `pod repo update --verbose`

1、之前运行pod setup,还会提示 /usr/local/bin 这个文件夹只可读,无法操作,所以更改下他的读写权限
sudo chmod go-w /usr/local/bin

如果出现
curl: (92) HTTP/2 stream 1 was not closed cleanly before end of the underlying stream
git config --global http.version HTTP/1.1
git config --global http.postBuffer 524288000
image.png

之后还是不行,但报错少了,之后继续看
说是 [!]未能连接到GitHub以更新CocoaPods/Specs Specs repo-请检查您是否脱机,或者GitHub是否已关闭
那我就找呗,GitHub我安装了 我觉得版本的问题所以我决定把之前的都重新卸载
gem list --local | grep cocoapods

image.png
gem uninstall cocoapods && \
sudo gem uninstall cocoapods-core && \
sudo gem uninstall cocoapods-deintegrate && \
sudo gem uninstall cocoapods-downloader && \
sudo gem uninstall cocoapods-plugins && \
sudo gem uninstall cocoapods-search && \
sudo gem uninstall cocoapods-stats && \
sudo gem uninstall cocoapods-trunk && \
sudo gem uninstall cocoapods-try
image.png

image.png

我又检查了下Gem没问题最新的 再装CocoaPods出错
说是没有找到Gem头文件 那我就弄gem

$ sudo gem install -n /usr/local/bin cocoapods
Building native extensions. This could take a while...
ERROR:  Error installing cocoapods:
    ERROR: Failed to build gem native extension.
    current directory: /Library/Ruby/Gems/2.3.0/gems/ffi-1.13.1/ext/ffi_c
/System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/bin/ruby -r ./siteconf20200718-36629-1xuhmuh.rb extconf.rb
mkmf.rb can't find header files for ruby at /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/include/ruby.h
extconf failed, exit code 1
Gem files will remain installed in /Library/Ruby/Gems/2.3.0/gems/ffi-1.13.1 for inspection.
Results logged to /Library/Ruby/Gems/2.3.0/extensions/universal-darwin-18/2.3.0/ffi-1.13.1/gem_make.out
$ curl -L https://get.rvm.io | bash -s stable
执行了下这个  出现
curl: (7) Failed to connect to raw.githubusercontent.com port 443: Connection refused
找好一会方法 试了下能否ping通  所以在代理下加入
199.232.68.133 raw.githubusercontent.com

$ brew -v
-bash: brew: command not found

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"

`https://raw.githubusercontent.com/Homebrew/install/master/install`,我打不开
所以下面是我的解决办法:
### 1\. 解决方式一
> 1.查看网址
打开网站:https://www.ipaddress.com/
查询一下 `raw.githubusercontent.com`对应的IP 地址


# No rvm rubies installed yet. Try 'rvm help install'.
$ rvm install 2.6
这时出现个警告  说是又最新的版本  让我选择更新方式 我选择了自动更新
echo rvm_autoupdate_flag=2>>~/.rvmrc
Installing requirements for osx.
Updating system...........Failed to update Homebrew, follow instructions at
    https://docs.brew.sh/Common-Issues
and make sure `brew update` works before continuing.
Error running 'requirements_osx_brew_update_system ruby-2.6.3',
please read /Users/xxx/.rvm/log/1595065720_ruby-2.6.3/update_system.log
Requirements installation failed with status: 1.



之后成功 ruby出了一系列警告 和提示 如果有按提示依次执行就行
最后可以检查ruby环境 brew doctor 以及版本
$ ruby -v
ruby 2.3.7p456 (2018-03-28 revision 63024) [universal.x86_64-darwin18]
进入rvm
source ~/.rvm/scripts/rvm
$ rvm -v
rvm 1.29.10-next (master) by Michal Papis, Piotr Kuczynski, Wayne E. Seguin [https://rvm.io]
$ rvm list
   ruby-2.7.1 [ x86_64 ]
# Default ruby not set. Try 'rvm alias create default <ruby>'.
# => - current
# =* - current && default
#  * - default

出现了以上  ruby就成功了  但是成功了之后CocoaPods 还没有安装成功
我就执行了
 xcode-select --install
xcode-select: error: command line tools are already installed, use "Software Update" to install updates
$ xcode-select -p
/Applications/Xcode.app/Contents/Developer
如果是之前的 Mac OS 版本,网上都是通过 xcode-select --install 来解决,但是我在 Mac OS 10.14 版本下,依然存在报错。
最终找到解决方式,执行:
open /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg

再次
 sudo gem install -n /usr/local/bin cocoapods
成功
pod setup
Setup completed
命令有点多 一执行就给覆盖了所以后来就没截图

下面是一些操作命令,以及方法

如果环境变量有问题的话

vi ~/.bash_profile
export PATH=/usr/local/rvm/bin:/opt/git1.7.10.2/bin:$PATH
更新环境变量.
$ source ~/.bashrc
$ source ~/.bash_profile

rvm autolibs read-only
rvm install ruby-2.7

手动安装  //先下载
wget http://production.cf.rubygems.org/rubygems/rubygems-1.8.24.tgz
解压
tar -zxvf rubygems-1.8.24.tgz
放到一个目录, (可选)
mv rubygems-1.8.24 /usr/local/rvm/src/


如果遇到 SSL 证书问题,你又无法解决,请修改 ~/.gemrc 文件,增加 ssl_verify_mode: 0 配置,以便于 RubyGems 可以忽略 SSL 证书错误。
---
:sources:
- https://gems.ruby-china.com
:ssl_verify_mode: 0



更新安装 brew的时候
$ source ~/.bashrc
$ source ~/.bash_profile
$ gem source -u

 brew install rbenv ruby-build
ruby-build与rbenv一起使用。以下几行安装Ruby 2.7.2,并将其设置为您的默认Ruby版本:
$ brew update
$ brew install ruby-build
$ brew install rbenv

$ rbenv install 2.7.2
$ rbenv global 2.7.2

brew install openssl@1.1


以及
pod setup
Setup completed 都好使了
pod search Bugly 不成功 
[!] Unable to find a pod with name, author, summary, or description matching `
之后一顿操作猛如虎 pod repo remove trunk 执行了下这个可以了
再不好使

pod repo remove master
cd ~/.cocoapods/repos
git clone --depth 1 https://github.com/CocoaPods/Specs.git master
rm ~/Library/Caches/CocoaPods/search_index.json
//进去项目工程执行search
pod search bugly

参考文章

http://daemon369.github.io/ruby/2017/12/14/01-install-ruby

pod --version
后报错遇到
Warning: the running version of Bundler (2.1.4) is older than the version that created the lockfile (2.4.12). We suggest you to upgrade to the version that created the lockfile by running `gem install bundler:2.4.12`.

Could not find proper version of cocoapods (1.12.1) in any of the sources

Run `bundle install` to install missing gems.



解决 命令:
gem update --system 3.0.8 && gem update --system

如果帮到您了 给个赞吧~

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
  • 序言:七十年代末,一起剥皮案震惊了整个滨河市,随后出现的几起案子,更是在滨河造成了极大的恐慌,老刑警刘岩,带你破解...
    沈念sama阅读 194,242评论 5 459
  • 序言:滨河连续发生了三起死亡事件,死亡现场离奇诡异,居然都是意外死亡,警方通过查阅死者的电脑和手机,发现死者居然都...
    沈念sama阅读 81,769评论 2 371
  • 文/潘晓璐 我一进店门,熙熙楼的掌柜王于贵愁眉苦脸地迎上来,“玉大人,你说我怎么就摊上这事。” “怎么了?”我有些...
    开封第一讲书人阅读 141,484评论 0 319
  • 文/不坏的土叔 我叫张陵,是天一观的道长。 经常有香客问我,道长,这世上最难降的妖魔是什么? 我笑而不...
    开封第一讲书人阅读 52,133评论 1 263
  • 正文 为了忘掉前任,我火速办了婚礼,结果婚礼上,老公的妹妹穿的比我还像新娘。我一直安慰自己,他们只是感情好,可当我...
    茶点故事阅读 61,007评论 4 355
  • 文/花漫 我一把揭开白布。 她就那样静静地躺着,像睡着了一般。 火红的嫁衣衬着肌肤如雪。 梳的纹丝不乱的头发上,一...
    开封第一讲书人阅读 46,080评论 1 272
  • 那天,我揣着相机与录音,去河边找鬼。 笑死,一个胖子当着我的面吹牛,可吹牛的内容都是我干的。 我是一名探鬼主播,决...
    沈念sama阅读 36,496评论 3 381
  • 文/苍兰香墨 我猛地睁开眼,长吁一口气:“原来是场噩梦啊……” “哼!你这毒妇竟也来了?” 一声冷哼从身侧响起,我...
    开封第一讲书人阅读 35,190评论 0 253
  • 序言:老挝万荣一对情侣失踪,失踪者是张志新(化名)和其女友刘颖,没想到半个月后,有当地人在树林里发现了一具尸体,经...
    沈念sama阅读 39,464评论 1 290
  • 正文 独居荒郊野岭守林人离奇死亡,尸身上长有42处带血的脓包…… 初始之章·张勋 以下内容为张勋视角 年9月15日...
    茶点故事阅读 34,549评论 2 309
  • 正文 我和宋清朗相恋三年,在试婚纱的时候发现自己被绿了。 大学时的朋友给我发了我未婚夫和他白月光在一起吃饭的照片。...
    茶点故事阅读 36,330评论 1 326
  • 序言:一个原本活蹦乱跳的男人离奇死亡,死状恐怖,灵堂内的尸体忽然破棺而出,到底是诈尸还是另有隐情,我是刑警宁泽,带...
    沈念sama阅读 32,205评论 3 312
  • 正文 年R本政府宣布,位于F岛的核电站,受9级特大地震影响,放射性物质发生泄漏。R本人自食恶果不足惜,却给世界环境...
    茶点故事阅读 37,567评论 3 298
  • 文/蒙蒙 一、第九天 我趴在偏房一处隐蔽的房顶上张望。 院中可真热闹,春花似锦、人声如沸。这庄子的主人今日做“春日...
    开封第一讲书人阅读 28,889评论 0 17
  • 文/苍兰香墨 我抬头看了看天上的太阳。三九已至,却和暖如春,着一层夹袄步出监牢的瞬间,已是汗流浃背。 一阵脚步声响...
    开封第一讲书人阅读 30,160评论 1 250
  • 我被黑心中介骗来泰国打工, 没想到刚下飞机就差点儿被人妖公主榨干…… 1. 我叫王不留,地道东北人。 一个月前我还...
    沈念sama阅读 41,475评论 2 341
  • 正文 我出身青楼,却偏偏与公主长得像,于是被迫代替她去往敌国和亲。 传闻我的和亲对象是个残疾皇子,可洞房花烛夜当晚...
    茶点故事阅读 40,650评论 2 335