Fundamentals 3 min read

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.

Programmer DD
Programmer DD
Programmer DD
Install Homebrew on macOS Using a Chinese Mirror to Bypass Network Blocks

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:443

The 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.com

However, 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 -v
Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

package managerInstallationmacOSGiteeHomebrew
Programmer DD
Written by

Programmer DD

A tinkering programmer and author of "Spring Cloud Microservices in Action"

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.