老款MacBook系统Monterey(MacOS 12)由于brew停止了从上游下载cocoapods提示不支持os12系统,无法安装最新版cocoapods,本文讲述了另一种方法来更新cocoapods

原文链接:http://www.kovli.com/2024/12/18/old-macos-install-cocoapods/

作者:Kovli

重要通知:红宝书第5版2024年12月1日出炉了,感兴趣的可以去看看,https://u.jd.com/saQw1vP

红宝书第五版中文版

红宝书第五版英文原版pdf下载(访问密码: 9696)

尝试过的方法:
sudo gem install cocoapods
sudo gem install cocoapods -pre
gem install cocoapods --user-install
sudo gem update cocoapods --version 1.16.2

均无法成功安装,系统ruby是2.6

后来尝试用brew安装
brew install ruby

提示报错如下:

Error: Your Command Line Tools are too outdated.
Update them from Software Update in System Preferences. If that doesn't show you any updates, run:
sudo rm -rf /Library/Developer/CommandLineTools
sudo xcode-select --install Alternatively, manually download them from:
https://developer.apple.com/download/all/.
You should download the Command Line Tools for Xcode 14.2.

经过检查是安装了命令行工具14.2的,也重复安装一遍还是报错同样错误,判断是版本太低不支持,但是xCode14.2已经是OS12系统的最新版本了,受限于系统无法升级。

于是想着升级下当前系统所支持的最高ruby版本2.7.2
brew install ruby@2.7

报错如下,

Error: ruby@2.7 has been disabled because it is not supported upstream! It was disabled on 2024-06-15.
尝试brew安装ruby2.6
brew install ruby@2.6

报错如下

No available formula with the name "ruby@2.6". Did you mean ruby@2.7, ruby@3.2, ruby@3.1 or ruby@3.0?

也就是说brew只支持安装ruby3以上

于是安装3.0版本试试
brew install ruby@3.0

结果报错如下

Error: You are using macOS 12.
We (and Apple) do not provide support for this old version.

说明brew已经不支持macOS12系统安装ruby3了,到这里可以看出,brew在macOS12系统已经安装不了ruby了

于是考虑用rvm
curl -L get.rvm.io | bash -s stable

顺利安装了rvm最新版

rvm 1.29.12 (latest) by Michal Papis, Piotr Kuczynski, Wayne E. Seguin [https://rvm.io]

先尝试安装ruby 3以上的,结果没成功,经过查询,最高支持安装2.7.2

rvm install 2.7.2

提示报错

Error running '__rvm_make -j8',

经检查问题出在openssl

卸载openssl

brew uninstall --ignore-dependencies openssl@3

重装低版本

    rm -rf /usr/local/etc/openssl@1.1
    brew reinstall openssl@1.1

提示报错

Error: openssl@1.1 has been disabled because it is not supported upstream! It was disabled on 2024-10-24.

此时有种换电脑的冲动了,但是不想让老外的计谋得逞,继续努力兼容!

brew edit openssl@1.1

会提示编辑如下文件

Editing /usr/local/opt/openssl@1.1/.brew/openssl@1.1.rb

通过编辑器或者vim编辑,注释下面这行

  deprecate! date: "2023-11-11", because: :unsupported
  # deprecate! date: "2023-11-11", because: :unsupported
然后执行:
HOMEBREW_NO_INSTALL_FROM_API=1 brew install openssl@1.1
HOMEBREW_NO_INSTALL_FROM_API=1 这个环境变量的作用就是告诉brew 不使用api中的formula而是使用你自己编辑后的, 这样就可以正常安装被brew禁止disable的软件包了。

上面的执行完再次安装2.7.2就可以成功

rvm install 2.7.2

设为默认ruby

rvm use 2.7.2 --default

更新了ruby从系统默认的2.6到rvm安装的2.7.2后再次尝试安装cocoapods

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

提示报错

ERROR:  Error installing cocoapods:
The last version of securerandom (>= 0.3) to support your Ruby & RubyGems was 0.3.2. Try installing it with `gem install securerandom -v 0.3.2` and then running the current command again
securerandom requires Ruby version >= 3.1.0. The current ruby version is 2.7.2.137.

按照指引继续安装securerandom

sudo gem install -n /usr/local/bin securerandom -v 0.3.2

然后重试

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

提示报错

ERROR:  Error installing cocoapods:
The last version of activesupport (>= 5.0, < 8) to support your Ruby & RubyGems was 7.1.5.1. Try installing it with `gem install activesupport -v 7.1.5.1` and then running the current command again
activesupport requires Ruby version >= 3.1.0. The current ruby version is 2.7.2.137.

按照指引开始安装activesupport

sudo gem install -n /usr/local/bin activesupport -v 7.1.5.1

继续重试

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

这次终于没报错了,安装成功,检查版本

~ pod --version
1.16.2

成功更新到新版cocoapods

tips:

1、RVM官方网站

https://rvm.io/workflow/examples#rvm-list

2、ruby可安装的版本信息

rvm list known

3、cocoapods所有版本

https://rubygems.org/gems/cocoapods/versions

4、cocoapods官网

https://guides.cocoapods.org/using/getting-started.html


版权声明:

转载时请注明作者Kovli以及本文地址:

http://www.kovli.com/2024/12/18/old-macos-install-cocoapods/


macOS Monterey(MacOS 12) 系统升级cocoapods的更多相关文章

  1. 在不受支持的 Mac 上安装 macOS Monterey 12

    请注意,当前为 Beta 版,后续会及时更新. 请访问原文链接:https://sysin.org/blog/install-macos-12-on-unsupported-mac/,查看最新版.原创 ...

  2. 在不受支持的 Mac 上安装 macOS Monterey 12(OpenCore Patcher)

    一.介绍 本文通用于 macOS Big Sur 和 macOS Monterey,也可以视作笔者 早期文章 的升级版. 这一章节将介绍 macOS Monterey 的系统要求和不受支持的 Mac ...

  3. macOS Monterey 12.1 (21C52) 正式版 ISO、IPSW、PKG 下载

    本站下载的 macOS Monterey 软件包,既可以拖拽到 Applications(应用程序)下直接安装,也可以制作启动 U 盘安装,或者在虚拟机中启动安装. 2021 年 12 月 14 日, ...

  4. macOS Monterey 12.12.2 (21D49) 正式版 ISO、IPSW、PKG 下载

    本站下载的 macOS Monterey 软件包,既可以拖拽到 Applications(应用程序)下直接安装,也可以制作启动 U 盘安装,或者在虚拟机中启动安装. 2022 年 1 月 27 日,m ...

  5. macOS Monterey 12.5 (21G72) 正式版 ISO、IPSW、PKG 下载

    今日(2022-07-21)凌晨,Apple 终于发布了 macOS Monterey 12.5,包括功能增强.错误修复和安全性更新.macOS Monterey 12.5 自 2022 年 5 月 ...

  6. 如何彻底禁止 macOS Monterey 自动更新,去除更新标记和通知

    请访问原文链接:如何彻底禁止 macOS Monterey 自动更新,去除更新标记和通知,查看最新版.原创作品,转载请保留出处. 作者主页:www.sysin.org 随着 macOS Montere ...

  7. 在macOS Sierra 10.12搭建PHP开发环境

    macOS Sierra 11.12 已经帮我们预装了 Ruby.PHP(5.6).Perl.Python 等常用的脚本语言,以及 Apache HTTP 服务器.由于 nginx 既能作为 HTTP ...

  8. 黑苹果macOS Sierra 10.12 安装教程(venue11 pro测试)

    黑苹果macOS Sierra 10.12 安装教程(venue11 pro测试) 2017-03-12 03:46:24 by SemiconductorKING PS:刚刚装好黑苹果,来记录一篇折 ...

  9. macOS Sierra(10.12.6), odoo(11.0), Python(3.5.4)配置

    欣闻odoo11支持python3环境了,赶紧在mac平台尝试一下: 前期设置,参考另篇文章:macOS Sierra 10.12.6 odoo 10.0 开发环境配置 因为odoo11尚未正式发布, ...

  10. macOS Sierra 10.12.6 odoo 10.0 开发环境配置

    参考了网上的一些教程,将最终过程记录一下,其中需要的一些程序,我已经放到百度网盘: https://pan.baidu.com/s/1boKHSTL 1.抹盘安装macOS Sierra 10.12. ...

随机推荐

  1. 一款基于 .NET + Blazor 开发的智能访客管理系统

    前言 在小区.企业.学校等场所,访客管理作为日常运营中不可或缺的一环,其重要性日益凸显.传统的访客管理方式往往依赖于人工登记.纸质记录,不仅效率低下,还存在信息易丢失.难以追溯等问题.今天大姚给大家分 ...

  2. .NET静态代码编织——肉夹馍(Rougamo)5.0

    肉夹馍(https://github.com/inversionhourglass/Rougamo),一款编译时AOP组件.相比动态代理AOP需要在应用启动时进行初始化,编译时完成代码编织的肉夹馍减少 ...

  3. 【Amadeus原创】修改docker里面网站的port端口映射

    切记:以下顺序千万不能颠倒!否则不生效! 1. 查看需要修改的容器,记住container id docker ps -a 2. 停止容器 docker stop xxx 3. 修改容器的端口映射配置 ...

  4. Docker学习笔记(一) - Docker安装

    1.安装yum-utils yum install yum-utils device-mapper-persistent-data lvm2 复制 安装yum-utils是为方便添加yum源使用的,d ...

  5. 龙哥量化:期货交易软件:文华、博易大师闪电手、快期,同花顺期货通,金字塔,MC,MT5,TB交易开拓者横向对比分析

    如果您需要代写公式, 请联系我. 龙哥QQ:591438821 龙哥微信:Long622889 此文档做对比分析, 我有空后给详细分析

  6. Qt编写的项目作品36-秘钥生成工具

    一.功能特点 (一)常规秘钥机制 远程联网激活,每次启动都联网查看使用时间等,这种方法最完美,缺点是没法联网的设备就歇菜了,而很多设备都是要求离线使用无法联网. 通过获取本地的硬盘+CPU等硬件的编号 ...

  7. Qt编写项目作品27-多线程文件传输

    一.功能特点 多线程收发文件,支持加密传输. 接收端支持监听端口接收文件和主动连接服务器接收文件两种方式. 按照 文件开始符+文件大小+文件内容+文件结束符 逐个分包接收. 可对接收的加密过的文件包进 ...

  8. Qt音视频开发29-Onvif云台控制

    一.前言 云台控制也是onvif功能中最常用的,最常用的功能排第一的是拿到视频流地址,排第二的就是云台控制了,云台控制的含义就是对带云台的摄像机进行上下左右的移动,一般云台摄像机都是带有一个小电机,一 ...

  9. JMeter使用指南+实验报告

    JMeter使用指南 目录 JMeter使用指南 界面基本配置方法 1.选项里的放大与缩小--缩放字体 2.选项里的选择语言 3.命令行的调出 注意事项 一些指标介绍 1.TCP取样器 2.汇总/聚合 ...

  10. ubuntu opencv安装与卸载

    安装opencv 1.在下面网站上下载所需版本的源文件Releases - OpenCVhttps://opencv.org/releases/ 2.解压并进入该文件夹 3.命令行执行如下指令    ...