macOS Monterey升级

家里的电脑磁盘空间用光了,导致macOS的升级一直失败,今天有空升级了下系统,升级到macOS Monterey。升级完发现homebrew用不了了。

报错如下:

HEAD is now at 884c4bec1 Merge pull request #14255 from SMillerDev/chore/docs/require_casks_pass_gatekeeper
Error:
  homebrew-core is a shallow clone.
  homebrew-cask is a shallow clone.
To `brew update`, first run:
  git -C /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core fetch --unshallow
  git -C /usr/local/Homebrew/Library/Taps/homebrew/homebrew-cask fetch --unshallow
These commands may take a few minutes to run due to the large size of the repositories.
This restriction has been made on GitHub's request because updating shallow
clones is an extremely expensive operation due to the tree layout and traffic of
Homebrew/homebrew-core and Homebrew/homebrew-cask. We don't do this for you
automatically to avoid repeatedly performing an expensive unshallow operation in
CI systems (which should instead be fixed to not use shallow clones). Sorry for
the inconvenience!
Failed during: /usr/local/bin/brew update --force --quiet

问题一:git -C /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core fetch --unshallow执行失败。

这个看起来是我之前用了 这个源 的homebrew。
但是它在2020年之后就没更新了,我把源调整为github,也是fetch失败。

最后我把/usr/local/Homebrew/Library/Taps/homebrew/homebrew-core 这个目录给删了,重新执行homebrew的初始化(/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)")。


问题二:raw.githubusercontent.com访问不了。

这两个指令一直执行失败,我尝试重装,也发现失败了。

后来我发现是raw.githubusercontent.com这个域名访问不了。原因如下:

$ nslookup raw.githubusercontent.com

Server:		192.168.3.1
Address:	192.168.3.1#53

Name:	raw.githubusercontent.com
Address: 0.0.0.0

$ nslookup /raw.githubusercontent.com

Server:		192.168.3.1
Address:	192.168.3.1#53

Non-authoritative answer:
Name:	/raw.githubusercontent.com
Address: 185.199.108.133
Name:	/raw.githubusercontent.com
Address: 185.199.111.133
Name:	/raw.githubusercontent.com
Address: 185.199.109.133

神奇的是,raw.githubusercontent.com的解析居然是0.0.0.0。

看起来是域名解析出错了,调整下hosts就好了

sudo vim /etc/hosts
185.199.109.133   raw.githubusercontent.com
185.199.110.133   raw.githubusercontent.com
185.199.108.133   raw.githubusercontent.com
185.199.111.133   raw.githubusercontent.com

问题三:python2消失了

brew install python@2
brew link --overwrite python@2

重装下就好了。

### 如何下载 macOS Monterey 12.0 官方版本 要下载 macOS Monterey 12.0 的官方版本,可以通过以下方式实现: #### 方法一:通过 Mac App Store 获取 如果您的设备已经运行 macOS 并支持升级macOS Monterey,则可以直接打开 **Mac App Store** 应用程序,在搜索框中输入“macOS Monterey”,找到对应的系统更新页面并点击“获取”或“安装”。这种方式是最简单且安全的方法[^1]。 #### 方法二:使用第三方提供的原版镜像文件 对于无法直接通过 Mac App Store 更新的情况(例如需要纯净安装),可以选择从可信的开发者处下载 macOS Monterrey 原版镜像。以下是具体操作指南: - 可信来源之一是名为“独行秀才”的博主发布的 Beta 版本镜像文件。这些镜像是基于 Apple 官方渠道制作而成,并经过作者亲测验证能够正常工作[^2][^3][^4]。 #### 验证镜像完整性 在完成下载之后,请务必校验所获得 ISO 文件的真实性与安全性: - 使用 Terminal 工具执行哈希计算命令来匹配所提供的 MD5、SHA1 和 SHA256 数字签名值。例如: ```bash openssl md5 /path/to/image.dmg openssl sha1 /path/to/image.dmg openssl dgst -sha256 /path/to/image.dmg ``` 如果得出的结果同公布的一致,则表明该镜像未被篡改过;反之则需重新尝试其他途径获取合法副本。 #### 注意事项 - 确保您使用的硬件满足最低配置需求; - 备份现有数据以防万一发生意外丢失情况; - 对于非正版授权机器(即所谓的“黑苹果”),可能仍存在兼容性问题尚未完全解决。 ```python import hashlib def verify_image(file_path, expected_hash_type='md5', expected_value=None): """Verify the integrity of a downloaded disk image.""" hash_func = getattr(hashlib, expected_hash_type)() with open(file_path,"rb") as f: for chunk in iter(lambda: f.read(4096), b""): hash_func.update(chunk) actual_value = hash_func.hexdigest() return actual_value == expected_value ```
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值