Install Homebrew on macOS Using a Chinese Mirror to Bypass Network Blocks
This guide shows how to resolve Homebrew installation failures on macOS caused by network restrictions by using a domestic Gitee mirror, including step‑by‑step commands, host file tweaks, and verification of the successful setup.
Yesterday my Mac got stuck at the startup progress bar, so I reinstalled the system and needed to set up basic software. As a macOS user, installing Homebrew is essential, but I encountered a network error when running the official install script.
% /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
curl: (35) LibreSSL SSL_connect: SSL_ERROR_SYSCALL in connection to raw.githubusercontent.com:443The usual fix is to look up the real IP of raw.githubusercontent.com (e.g., via https://www.ipaddress.com/) and add it to the /etc/hosts file:
sudo vim /etc/hosts 185.199.108.133 raw.githubusercontent.comHowever, this method still caused the download to stop halfway.
Instead, I used a domestic mirror hosted on Gitee, which worked smoothly.
Steps:
Open Terminal and run the following command to fetch the Homebrew installation script from the Gitee mirror:
/bin/zsh -c "$(curl -fsSL https://gitee.com/cunkai/HomebrewCN/raw/master/Homebrew.sh)"Follow the on‑screen prompts (see images below).
When the installation finishes, you will see a completion screen.
Finally, verify the installation by printing the Homebrew version:
brew -vSigned-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
Programmer DD
A tinkering programmer and author of "Spring Cloud Microservices in Action"
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
