在macOS 10.15.7上安装Homebrew

可以使用以下步骤。由于macOS 10.15.7是一个较旧的版本,建议使用国内镜像源来加速安装过程。

安装前准备

  1. 确保系统要求

    • macOS 10.15.7

    • 已安装 Command Line Tools (CLT)

  2. 安装 Command Line Tools

    bash复制

    xcode-select --install

更新了git

gitee安装

/bin/zsh -c "$(curl -fsSL https://gitee.com/cunkai/HomebrewCN/raw/master/Homebrew.sh)"

进入界面

选择的2

继续

安装成功 但还需要重启终端 或者 运行 source /Users/skyhx/.zprofile   否则国内地址无法生效

source /Users/skyhx/.zprofile

查看 Homebrew 版本

skyhx@HXdeMacBook-Pro bin % brew --version

Homebrew 4.4.16

权限问题

sudo chown -R $(whoami) $(brew --prefix)/*

sudo chown -R $(whoami) $(brew --prefix)/*

重置镜像源(恢复官方源)

# 重置 brew.git
git -C "$(brew --repo)" remote set-url origin https://github.com/Homebrew/brew.git

skyhx@HXdeMacBook-Pro bin % python

WARNING: Python 2.7 is not recommended. 

This version is included in macOS for compatibility with legacy software. 

Future versions of macOS will not include Python 2.7. 

Instead, it is recommended that you transition to using 'python3' from within Terminal.

Python 2.7.16 (default, Jun  5 2020, 22:59:21) 

[GCC 4.2.1 Compatible Apple LLVM 11.0.3 (clang-1103.0.29.20) (-macos10.15-objc- on darwin

Type "help", "copyright", "credits" or "license" for more information.

使用Homebrew安装Python 3:

skyhx@HXdeMacBook-Pro bin % brew install python@3.8
==> Downloading https://mirrors.tuna.tsinghua.edu.cn/homebrew-bottles/api/formul
#=#=-#  #                                                                      
==> Downloading https://mirrors.tuna.tsinghua.edu.cn/homebrew-bottles/api/cask.j
##O#- #                                                                        
Warning: You are using macOS 10.15.
We (and Apple) do not provide support for this old version.
It is expected behaviour that some formulae will fail to build in this old version.
It is expected behaviour that Homebrew will be buggy and slow.
Do not create any issues about this on Homebrew's GitHub repositories.
Do not create any issues even if you think this message is unrelated.
Any opened issues will be immediately closed without response.
Do not ask for help from Homebrew or its maintainers on social media.
You may ask for help in Homebrew's discussions but are unlikely to receive a response.
Try to figure out the problem yourself and submit a fix as a pull request.
We will review it but may or may not accept it.

Error: python@3.8 has been disabled because it is deprecated upstream! It was disabled on 2024-10-14.
skyhx@HXdeMacBook-Pro bin % 

不知道为啥  清华源失败了

安装python3.7

skyhx@HXdeMacBook-Pro bin % brew install python@3.7
Warning: No available formula with the name "python@3.7". Did you mean python@3.9, python@3.8, python@3.13, python@3.12, python@3.11, python@3.10 or python-yq?
==> Searching for similarly named formulae and casks...
==> Formulae
python@3.9          python@3.13         python@3.11         python-yq
python@3.8          python@3.12         python@3.10

To install python@3.9, run:
  brew install python@3.9
skyhx@HXdeMacBook-Pro bin % 
skyhx@HXdeMacBook-Pro bin % 

source /Users/skyhx/.zprofile

刷新环境变量

skyhx@HXdeMacBook-Pro ~ % pwd

/Users/skyhx

ls -a 可以看到隐藏的文件信息

skyhx@HXdeMacBook-Pro ~ % more .zprofile



  export HOMEBREW_PIP_INDEX_URL=http://mirrors.aliyun.com/pypi/simple #ckbrew
  export HOMEBREW_API_DOMAIN=https://mirrors.aliyun.com/homebrew/homebrew-bottles/api  #ckbrew
  export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.aliyun.com/homebrew/homebrew-bottles #ckbrew
  eval $(/usr/local/Homebrew/bin/brew shellenv) #ckbrew

skyhx@HXdeMacBook-Pro ~ % 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值