Mac 下 brew 切换为国内源
简介
Homebrew 是一款自由及开放源代码的软件包管理系统,用以简化 macOS 和 linux 系统上的软件安装过程。它拥有安装、卸载、更新、查看、搜索等很多实用的功能,通过简单的一条指令,就可以实现包管理,十分方便快捷。
Homebrew 主要有四个部分组成: brew、homebrew-core 、homebrew-bottles、homebrew-cask。
| 名称 | 说明 |
|---|---|
| brew | Homebrew 源代码仓库 |
| homebrew-core | Homebrew 核心软件仓库 |
| homebrew-bottles | Homebrew 预编译二进制软件包 |
| homebrew-cask | 提供 macOS 应用和大型二进制文件 |
替换为阿里源
# 查看 brew.git 当前源
$ cd "$(brew --repo)" && git remote -v
origin https://github.com/Homebrew/brew.git (fetch)
origin https://github.com/Homebrew/brew.git (push)
# 查看 homebrew-core.git 当前源
$ cd "$(brew --repo homebrew/core)" && git remote -v
origin https://github.com/Homebrew/homebrew-core.git (fetch)
origin https://github.com/Homebrew/homebrew-core.git (push)
# 修改 brew.git 为阿里源
$ git -C "$(brew --repo)" remote set-url origin https://mirrors.aliyun.com/homebrew/brew.git
# 修改 homebrew-core.git 为阿里源
$ git -C "$(brew --repo homebrew/core)" remote set-url origin https://mirrors.aliyun.com/homebrew/homebrew-core.git
# zsh 替换 brew bintray 镜像
$ echo 'export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.aliyun.com/homebrew/homebrew-bottles' >> ~/.zshrc
$ source ~/.zshrc
# bash 替换 brew bintray 镜像
$ echo 'export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.aliyun.com/homebrew/homebrew-bottles' >> ~/.bash_profile
$ source ~/.bash_profile
# 刷新源
$ brew update
替换为清华源
# 替换各个源
$ git -C "$(brew --repo)" remote set-url origin https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/brew.git
$ git -C "$(brew --repo homebrew/core)" remote set-url origin https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-core.git
$ git -C "$(brew --repo homebrew/cask)" remote set-url origin https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-cask.git
# zsh 替换 brew bintray 镜像
$ echo 'export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.tuna.tsinghua.edu.cn/homebrew-bottles' >> ~/.zshrc
$ source ~/.zshrc
# bash 替换 brew bintray 镜像
$ echo 'export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.tuna.tsinghua.edu.cn/homebrew-bottles' >> ~/.bash_profile
$ source ~/.bash_profile
# 刷新源
$ brew update
替换为中科大源
# 替换各个源
$ git -C "$(brew --repo)" remote set-url origin https://mirrors.ustc.edu.cn/brew.git
$ git -C "$(brew --repo homebrew/core)" remote set-url origin https://mirrors.ustc.edu.cn/homebrew-core.git
$ git -C "$(brew --repo homebrew/cask)" remote set-url origin https://mirrors.ustc.edu.cn/homebrew-cask.git
# zsh 替换 brew bintray 镜像
$ echo 'export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.ustc.edu.cn/homebrew-bottles' >> ~/.zshrc
$ source ~/.zshrc
# bash 替换 brew bintray 镜像
$ echo 'export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.ustc.edu.cn/homebrew-bottles' >> ~/.bash_profile
$ source ~/.bash_profile
# 刷新源
$ brew update
重置为官方源
# 重置 brew.git 为官方源
$ git -C "$(brew --repo)" remote set-url origin https://github.com/Homebrew/brew.git
# 重置 homebrew-core.git 为官方源
$ git -C "$(brew --repo homebrew/core)" remote set-url origin https://github.com/Homebrew/homebrew-core.git
# 重置 homebrew-cask.git 为官方源
$ git -C "$(brew --repo homebrew/cask)" remote set-url origin https://github.com/Homebrew/homebrew-cask
# zsh 注释掉 HOMEBREW_BOTTLE_DOMAIN 配置
$ vi ~/.zshrc
# export HOMEBREW_BOTTLE_DOMAIN=xxxxxxxxx
# bash 注释掉 HOMEBREW_BOTTLE_DOMAIN 配置
$ vi ~/.bash_profile
# export HOMEBREW_BOTTLE_DOMAIN=xxxxxxxxx
# 刷新源
$ brew update
Mac 下 brew 切换为国内源的更多相关文章
- mac下brew install 报错
mac下brew install 报错 错误提示: 原因:是这个brew的权限不正确 修改一下这个brew的权限 chown root:wheel /usr/local/bin/brew
- Mac下brew安装与配置mysql
一.打开mac控制台 $ brew install mysql 二.启动mysql服务 $ mysql.server start 三.初始化mysql配置 1 rainMacBook-Pro:~ co ...
- mac os下切换pip3国内源并安装requests库
在使用Python的时候,经常会用到pip来安装模块,但是默认的下载源实在是特别慢,经常install的时候还会因为速度的原因直接报错,因此我们可以选择将下载源更改为国内的,这样就可以提高我们的下载速 ...
- Brew 替换为国内源Mac
# 替换brew.git cd "$(brew --repo)" git remote set-url origin https://mirrors.aliyun.com/home ...
- Mac下brew/memcached/nginx/iterm/zsh的安装
brew https://www.cnblogs.com/fireworld/p/8609190.html memcached https://blog.csdn.net/whereismatrix ...
- Mac 下 brew的卸载 插件
brew 又叫 Homebrew,是 Mac OSX 上的软件包管理工具,能在 Mac 命令行中方便的安装软件或者卸载软件, 只需要一个命令, 非常方便 brew 类似 ubuntu 系统下的 apt ...
- conda 切换为国内源
添加清华源 conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/ conda con ...
- docker学习------记录centos7.5下docker安装更换国内源的处理过程
一.centos7.5下更换阿里源 1.装好centos7.5镜像,将yum源更换为阿里源 第一步:刚出的centos7.5是解析不到阿里的东西的,所以找了台centos7.4,下载一些包 (1) 下 ...
- Mac下brew安装JDK的教程
---恢复内容开始--- 安装命令: brew cask install java 默认应该会下载jdk7 也可以指定下载版本brew cask install java6 注意: brew inst ...
随机推荐
- Linux中更换为国内镜像源
推荐使用清华镜像:https://mirrors.tuna.tsinghua.edu.cn/help/ubuntu/ 将下列文本添加到/etc/apt/sources.list文件里 # 默认注释了源 ...
- Go语言之Go语言变量
GO 语言变量 Go语言是静态类型语言,因此变量(variable)是有明确类型的,编译器也会检查变量类型的正确性. 标识符 在编程语言中标识符就是程序员定义的具有特殊意义的词,比如变量名.常量名.函 ...
- 基于Modbus三种CRC16校验方法的性能对比
目录 1.背景介绍 2. CRC校验的三种方法 2.1. 直接计算CRC校验 2.2. 查短表法计算CRC16校验 2.3.查大表法计算CRC16校验 3.三种校验方式的测试方法 3.1.直接计算CR ...
- 洛谷 P3909 异或之积 题解
原题链接 本人看了其它解法,发现本人的解法还是 首创 ! 而且我的解法好像和 \(\times 6\) 没什么关系 -- (如果没 \(\times 6\),我没还不用算逆元) 别人的思路呢,大都是从 ...
- leetcode之820. 单词的压缩编码 | python极简实现字典树
题目 给定一个单词列表,我们将这个列表编码成一个索引字符串 S 与一个索引列表 A. 例如,如果这个列表是 ["time", "me", "bell& ...
- element-ui 的 单选按钮(Radio) 怎么取消文本显示?
方法一:<el-radio class="radio" v-model="radio" :label="1"> </el- ...
- CSAPP-bomblab
DO NOT READ THIS ARTICLE. I wrote bullshit in English. This lab I have finished once, so this articl ...
- 本地缓存Ehcache
1,什么是Ehcache Ehcache是纯java的开源缓存框架,具有快速.精干等特点,是Hibernate中默认的CacheProvider.它主要面向通用缓存.Java EE和轻量级容器, ...
- js Object方法小结
1. Object.defineProperty(obj,prop,{ value:..., writable:boolean,//可写 ...
- 总结:自动将函数对象添加到字典的bug
介绍 本文以ATM项目为背景,介绍一个比较实用的编程技巧,使用装饰器将项目中的指定函数添加到字典中. 利用字典通过key访问value的特点,实现用户输入编号,通过字典直接获取并调用编号对应的功能函数 ...