Homebrew 更换阿里云镜像源

653 阅读1分钟

安装zsh

# 1. 打开 iTerm2
# 2. 通过 git 下载:
git clone git://github.com/robbyrussell/oh-my-zsh.git ~/.oh-my-zsh
# 3. 复制创建~/.zshrc配置文件:
cp ~/.oh-my-zsh/templates/zshrc.zsh-template ~/.zshrc
# 4. bash 切换成 zsh :
chsh -s /bin/zsh
# 5. 按照提醒输入密码,完全退出iTerm2
$ git clone https://github.com/mbadolato/iTerm2-Color-Schemes.git

打开 iterm2 > profiles > open profiles > edit profiles
点击 profiles > colors > 右下角import 导入刚刚在哪文件找到的主题

光标按照单词快速移动 分别修改option+←option+→的映射如下图所示,选择Action为Send Escape Sequence,然后输入“b”和“f”即可。

你可能有过这样糟糕的经历,当你满心欢喜的敲下 “brew install 应用名称”,静静的等待安装结果的时候,Homebrew在 Updating Homebrew卡死了。

如果你没有更换过镜像源,执行 brew 命令安装应用的时候,跟以下 3 个仓库地址有关:

  • brew.git
  • homebrew-core.git
  • homebrew-bottles 通过以下操作将这 3 个仓库地址全部替换为 阿里云 提供的地址

更换 brew.git

cd "$(brew --repo)"
git remote set-url origin https://mirrors.aliyun.com/homebrew/brew.git

更换更换 homebrew-core.git

cd "$(brew --repo)/Library/Taps/homebrew/homebrew-core"
git remote set-url origin https://mirrors.aliyun.com/homebrew/homebrew-core.git

此时可以执行brew updatebrew config 查看配置信息.

更换 homebrew-bottles

echo 'export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.aliyun.com/homebrew/homebrew-bottles' >> ~/.zshrc
source ~/.zshrc

blog.lucien.ink/archives/39…

iTerm2 是 Mac 下最好用的终端工具,比 Mac 自带 terminal 方便易用。安装步骤如下:

$ brew install iTerm2