Mac M1 安装 Homebrew

 

------------------------------------最常用命令---------------------------------

搜索软件: brew search 软件包名称

安装软件: brew install 软件包名称

卸载软件: brew uninstall 软件包名称

 

------------------------------------错误解决------------------------------------

问题1 : curl: (7) Failed to connect to http://raw.githubusercontent.com port 443: Connection refused” 错误

解决方法:

打开 www.ipaddress.com 网站查询 raw.githubusercontent.com 主机的真实IP

打开 /etc/hosts 文件,增加一条记录

185.199.108.133    raw.githubusercontent.com 

问题2如果 brew install 出以下错误, 则安装时使用 arch -arm64 brew install 软件包名 进行安装

开始

 

1. 创建安装目录

Homebrew 安装脚本会将程序默认装至 /usr/local/Homebrew ,这是 Intel 芯片架构上的安装路径,M1芯片上则需要安装到 /opt/Homebrew/ 下。

sudo mkdir -p /opt/homebrew

sudo chown -R $(whoami) /opt/homebrew

2. 下载 homebrew 包并解压至 /opt/homebrew 目录

curl -L https://github.com/Homebrew/brew/tarball/master | tar xz --strip 1 -C homebrew

如果下载慢,可以直接通过 https://github.com/Homebrew/brew/tarball/master 或 天翼云盘链接 下载后,copy 到 /opt 目录下再将压缩包解压到 /opt/homebrew 目录

cp /opt

tar xz 压缩包名 --strip 1 -C homebrew

 

3. 将路径增加到PATH环境变量中

vim ~/.bash_profile
#在 .bash_profile 中新增

export PATH=$PATH:/opt/homebrew/bin;

#保存退出
#刷新生效
source ~/.bash_profile

4. 修改源

cd "$(brew --repo)"
git clone https://mirrors.ustc.edu.cn/brew.git


cd "$(brew --repo)/Library/Taps/homebrew"

git clone https://mirrors.ustc.edu.cn/homebrew-core.git

git clone https://mirrors.ustc.edu.cn/homebrew-cask.git

brew update #更新

其它镜像地址: 

HomeBrew 官方镜像:
    brew: https://github.com/Homebrew/brew
    core: https://github.com/Homebrew/homebrew-core
    cask: https://github.com/Homebrew/homebrew-cask

清华大学镜像:
    brew: https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/brew.git
    core: https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-core.git
    cask: https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-cask.git

中科大镜像:
    brew: https://mirrors.ustc.edu.cn/brew.git
    core: https://mirrors.ustc.edu.cn/homebrew-core.git
    cask: https://mirrors.ustc.edu.cn/homebrew-cask.git

5. 终于可以进行下载软件了

brew install -s 软件包名

 

  • 0
    点赞
  • 6
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

后端木木

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值