总结: 系统配置常见问题及答案
Github
使用 Homebrew 安装 Emacs 时, 出现类似提示: Failed to connect to raw.githubusercontent.com port 443: Connection refused
解答: 修改 Hosts
- 通过 https://www.ipaddress.com/ 查询 raw.githubusercontent.com 的 IP 地址
修改 /private/etc/hosts 文件, 增加一行:
查到的 IP raw.githubusercontent.com
Homebrew
是什么?
Homebrew是 mac的包管理器,仅需执行相应的命令,就能下载安装需要的软件包,可以省掉自己去下载、解压、拖拽(安装)等繁琐的步骤。
Homebrew 主要由四个部分组成: brew、homebrew-core 、homebrew-cask、homebrew-bottles,它们对应的功能如下:
组成 | 功能 |
---|---|
Homebrew | 源代码仓库 |
homebrew-core | Homebrew 核心源 |
homebrew-cask | 提供macos应用和大型二进制文件的安装 |
homebrew-bottles | 预编译二进制软件包 |
问题是?
安装Homebrew 时速度超级慢
解答: 从中科大的镜像源下载安装 Homebrew
/usr/bin/ruby -e "$(curl -fsSL https://cdn.jsdelivr.net/gh/ineo6/homebrew-install/install)"
安装Homebrew 时, 卡在了Cloning into 环节
解答: 按C-c 中断下载, 更新下载源
cd "$(brew --repo)/Library/Taps/" mkdir homebrew && cd homebrew git clone git://mirrors.ustc.edu.cn/homebrew-core.git
安装成功后, 使用brew install 软件 速度超级慢
解答: 继续更改软件包的下载源
# 替换 brew.git: git -C "$(brew --repo)" remote set-url origin https://mirrors.ustc.edu.cn/brew.git # 替换 homebrew-core.git: git -C "$(brew --repo homebrew/core)" remote set-url origin https://mirrors.ustc.edu.cn/homebrew-core.git # 替换 homebrew-cask.git: git -C "$(brew --repo homebrew/cask)" remote set-url origin https://mirrors.ustc.edu.cn/homebrew-cask.git # 替换homebrew-bottles: # 首先要先区分你的mac用哪种终端工具,如果是 bash,则执行: 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