专业的编程技术博客社区

网站首页 > 博客文章 正文

mac安装brew 录下安装的坑。(brew install mas)

baijin 2024-09-02 11:08:39 博客文章 2 ℃ 0 评论

python 第一天 记录下安装的坑。

mac安装brew

最简单的方法就是上到http://www.homebrewsoftware.com,按这个直接安装。

/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

但是,这样就老是下载不了,查了查,有一些文章说是墙的问题,连了VPN,也不行,很慢,才几K

源的问题,把源改成国内的一个中科院的源https://mirrors.ustc.edu.cn/brew.git

1、首先安装brew 是要到网站上去取脚本

来获取install文件

curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install >> brew_install.rb

2、其次是打开brew_install.rb

把其中一段用#注释了

#BREW_REPO = “https://github.com/Homebrew/brew“.freeze

并改成国内的源,如下:

BREW_REPO = “https://mirrors.ustc.edu.cn/brew.git “.freeze

3、转到brew_install.rb 文件目录下,执行 /usr/bin/ruby brew_install.rb

然后就是安装了,比原来快了。

但是。。。出错了

==> Tapping homebrew/core

Cloning into '/usr/local/Homebrew/Library/Taps/homebrew/homebrew-core'...

fatal: unable to access 'https://github.com/Homebrew/homebrew-core/': LibreSSL SSL_read: SSL_ERROR_SYSCALL, errno 60

Error: Failure while executing; `git clone https://github.com/Homebrew/homebrew-core /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core --depth=1` exited with 128.

Error: Failure while executing; `/usr/local/bin/brew tap homebrew/core` exited with 1.

Failed during: /usr/local/bin/brew update --force


4、出现这个原因是因为源不通,那我们的解决方法就是更换国内镜像源:

执行下面这句命令,更换镜像:

git clone git://mirrors.ustc.edu.cn/homebrew-core.git/ /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core --depth=1

然后OK,已经下载成功了

Cloning into '/usr/local/Homebrew/Library/Taps/homebrew/homebrew-core'...

remote: Counting objects: 5127, done.

remote: Compressing objects: 100% (4928/4928), done.

remote: Total 5127 (delta 40), reused 869 (delta 4)

Receiving objects: 100% (5127/5127), 4.15 MiB | 3.44 MiB/s, done.

Resolving deltas: 100% (40/40), done.


5、修改homebrew-core

cd "$(brew --repo)"

git remote set-url origin https://mirrors.ustc.edu.cn/brew.git

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

git remote set-url origin https://mirrors.ustc.edu.cn/homebrew-core.git

执行更新

brew update

成功!


6、默认源替换为国内 USTC 源的方法。

替换核心软件仓库

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

git remote set-url origin https://mirrors.ustc.edu.cn/homebrew-core.git

替换 cask 软件仓库(提供 macOS 应用和大型二进制文件

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

git remote set-url origin https://mirrors.ustc.edu.cn/homebrew-cask.git


替换 Bottles 源(Homebrew 预编译二进制软件包)

bash(默认

echo 'export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.ustc.edu.cn/homebrew-bottles' >> ~/.bash_profile

source ~/.bash_profilez


echo 'export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.ustc.edu.cn/homebrew-bottles' >> ~/.zshrc

source ~/.zshrc


OK,开始使用吧。


Tags:

本文暂时没有评论,来添加一个吧(●'◡'●)

欢迎 发表评论:

最近发表
标签列表