Mac安装homebrew和brew cask
在mac系统中,使用homebrew可以很方便的管理包.
官网提供的安装指令:
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
执行起来总是
结果还是被卡在下载阶段,报错如下:
LibreSSL SSL_read: SSL_ERROR_SYSCALL, errno 54
应该是这个资源访问有问题,那么我们可以尝试使用国内的镜像(中科大,清华)。
中科大源 https://mirrors.ustc.edu.cn/brew.git
一. 获取install文件
cd ~
curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install >> brew_install
二.更改脚本中的资源链接,替换成中科大的镜像
编辑brew_install文件
#!/System/Library/Frameworks/Ruby.framework/Versions/Current/usr/bin/ruby
# This script installs to /usr/local only. To install elsewhere you can just
# untar https://github.com/Homebrew/brew/tarball/master anywhere you like or
# change the value of HOMEBREW_PREFIX.
HOMEBREW_PREFIX = "/usr/local".freeze
HOMEBREW_REPOSITORY = "/usr/local/Homebrew".freeze
HOMEBREW_CACHE = "#{ENV["HOME"]}/Library/Caches/Homebrew".freeze
HOMEBREW_OLD_CACHE = "/Library/Caches/Homebrew".freeze
#BREW_REPO = "https://github.com/Homebrew/brew".freeze
BREW_REPO = "https://mirrors.ustc.edu.cn/brew.git".freeze
#CORE_TAP_REPO = "https://github.com/Homebrew/homebrew-core".freeze
CORE_TAP_REPO = "https://mirrors.ustc.edu.cn/homebrew-core.git".freeze
注释掉BREW_REPO = "https://github.com/Homebrew/brew".freeze
和CORE_TAP_REPO = "https://github.com/Homebrew/homebrew-core".freeze
修改为BREW_REPO = "https://mirrors.ustc.edu.cn/brew.git".freeze
和CORE_TAP_REPO = "https://mirrors.ustc.edu.cn/homebrew-core.git".freeze
第三步,执行安装Homebrew脚本
/usr/bin/ruby brew_install
然后可以看到这几句:
==> 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 54
Error: Failure while executing: git clone https://github.com/Homebrew/homebrew-core /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core --depth=1
Error: Failure while executing: /usr/local/bin/brew tap homebrew/core
出现这个原因是因为源不通,代码来不下来,解决方法就是更换国内镜像源:
执行下面这句命令,更换为中科院的镜像就下载成功了
git clone git://mirrors.ustc.edu.cn/homebrew-core.git/ /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core --depth=1
替换homebrew和homebrew-core的镜像地址为中科院的国内镜像
cd "$(brew --repo)"
git remote set-url origin https://mirrors.ustc.edu.cn/brew.gitcd "$(brew --repo)/Library/Taps/homebrew/homebrew-core"
git remote set-url origin https://mirrors.ustc.edu.cn/homebrew-core.git
执行更新,成功:
brew update
最后用这个命令检查无错误:
brew doctor
这样就可以直接使用 brew 命令安装软件了。
第四步:安装brew cask
brew 安装完毕,安装brew cask
brew install caskroom/cask/brew-cask
出现error:
Error: Cask 'brew-cask' is unavailable: '/usr/local/Homebrew/Library/Taps/caskroom/homebrew-cask/Casks/brew-cask.rb' does not exist.
解决方法如下:
brew install brew-cask-completion
测试输入如下:
brew cask search qq
返回结果如下则成功:
==> Exact Match
qq
==> Partial Matches
qqbrowser qqinput qqlive qqmacmgr qqmusic
替换brew cask的镜像地址为中科院的国内镜像
cd "$(brew --repo)"/Library/Taps/homebrew/homebrew-cask
git remote set-url origin https://mirrors.ustc.edu.cn/homebrew-cask.git
第五步. 替换 Bottles 源
Homebrew Bottles是Homebrew提供的二进制代码包,目前镜像站收录了以下仓库:
homebrew/homebrew-core
homebrew/homebrew-dupes
homebrew/homebrew-games
homebrew/homebrew-gui
homebrew/homebrew-python
homebrew/homebrew-php
homebrew/homebrew-science
homebrew/homebrew-versions
homebrew/homebrew-x11
替换方式如下
- bash(默认 shell)用户
echo 'export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.ustc.edu.cn/homebrew-bottles' >> ~/.bash_profile
source ~/.bash_profile
- 对于zsh用户
echo 'export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.ustc.edu.cn/homebrew-bottles' >> ~/.zshrc
source ~/.zshrc
参考:
执行 brew install 命令长时间卡在 Updating Homebrew 的解决方法
https://learnku.com/articles/18908
Homebrew 中文主页
https://brew.sh/index_zh-cn.html
Homebrew Bottles 源使用帮助
http://mirrors.ustc.edu.cn/help/homebrew-bottles.html
Homebrew Cask 源使用帮助
http://mirrors.ustc.edu.cn/help/homebrew-cask.git.html
Homebrew Core 源使用帮助
http://mirrors.ustc.edu.cn/help/homebrew-core.git.html
Mac安装homebrew和brew cask相关推荐
- mac 安装Homebrew提示brew command not found的解决方法
mac端安装brew的方法:只需要打开终端,输入以下代码即可 /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com ...
- mac安装homebrew + git + nodejs
mac安装homebrew等记录: 趁热记录一波 1. 安装homebrew 直接执行 : /bin/bash -c "$(curl -fsSL https://raw.githubuser ...
- 解决Mac安装Homebrew失败
首先使用Homebrew官网的安装shell命令安装: /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebr ...
- Mac安装Homebrew
文章目录 1.Homebrew是什么? 1.安装hombrew 2.brew cask 安装 2.设置环境变量 3.更换为国内镜像源 4.Homebrew基本用法 5.安装软件 1.安装jmeter ...
- mac安装Homebrew报443
mac安装Homebrew报443 /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install ...
- Mac安装HomeBrew及update报错Error: Fetching /opt/homebrew/Library/Taps/homebrew/homebrew-cask failed
Mac安装HomeBrew及update报错Error: Fetching /opt/homebrew/Library/Taps/homebrew/homebrew-cask failed! 报错 运 ...
- 【Mac】mac安装redis客户端 Error: Cask ‘rdm‘ is unavailable: No Cask with this name exist
1.概述 mac安装redis客户端 rdm,报错如下 [lcc@lcc ~]$ brew cask install rdm Updating Homebrew... Error: Cask 'rdm ...
- Mac安装Homebrew的正确姿势
Homebrew 是什么 Homebrew是 mac的包管理器,仅需执行相应的命令,就能下载安装需要的软件包,可以省掉自己去下载.解压.拖拽(安装)等繁琐的步骤. 比如安装服务器 nginx,打开终端 ...
- mac安装win7之后鼠标失灵_排雷之后终于找到了解决mac安装Homebrew的报错
几经折腾,我终于安装好了ncdu,准确来说,我是安装好了homebrew. 我觉得不是我一个人是这样的折腾,所以排雷之后告诉你们 ♂️ 想要马上看解决方法的也可以空投到最后的方法 @[TOC] ...
最新文章
- 十六进制字符转二进制字符
- pls-00302: 必须声明 组件_手把手教你开发vue组件库
- 防止抓取html代码,网页中用html代码注释的内容会被抓取吗
- springboot整合spring @Cache和Redis
- gradle spring_用于Spring应用程序的Gradle原型
- 中科大 计算机网络9 互联网历史
- oracle创建目录的命令,使用create database命令手工创建Oracle数据库
- python爬取新闻发送微信_如何利用 Python 爬虫实现给微信群发新闻早报?(详细)...
- 原来这些网站功能这么强?做梦都没想到那些软件都不是他的对手!
- 爆销产品标题怎么写_7个让销量暴增的商品标题文案套路
- 计算机考研数据结构高分笔记,2021版天勤计算机考研高分笔记系列:数据结构高分笔记(第9版)...
- .xmind用什么软件打开_swf文件用什么打开 怎么把swf转换成mp4
- Android MVP架构简析
- 高中计算机技术基础教学ppt,高中信息技术教学课件
- api—淘宝图片上传
- 【C++编程题】字符串子串替换
- excel--转化IP地址为十进制
- nvcc与nvidia
- 排列组合的简单应用(隔板法)
- cannot simultaneously fetch multiple bags 异常的解决办法