How to Install Homebrew on Mac

Online installation

Find Homebrew's official website in the search engine: Homebrew
Please add image description
install Homebrew here provides a MacOS terminal command

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

Copy to the terminal manager and run, then wait for him to install it step by step.
Use the terminal command to view the version of Homebrew to install

brew -v

error may occur

Failed to connect to raw.githubusercontent.com port 443: Connection refused

Please add image description

Method 1 (using Brew to automatically install the program):

Type in the terminal :

/bin/zsh -c "$(curl -fsSL https://gitee.com/cunkai/HomebrewCN/raw/master/Homebrew.sh)"

Please add image description
Step by step according to your needs

Method 2 (Host):

IP of Homebrew found so far

185.199.108.133
185.199.109.133
![请添加图片描述](https://img-blog.csdnimg.cn/73d9af08ce7a4976b9c4163eb6c8c297.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3dlaXhpbl81MDY3OTE2Mw==,size_16,color_FFFFFF,t_70)

185.199.111.133

Then type in the terminal

sudo vim /etc/hosts

Modify the Host
Please add image description
in the Vim editor (hint: in the Vim editor, enter "i" to edit , Esc to exit the editing mode after editing , and then enter ":wq" to save and exit )
to install again

Offline installation Failed to install online, you can use offline installation

Download the offline Homebrew installation file Baidu network disk Extraction code: p4fr After
Please add image description
downloading, enter the terminal, cd to the file path (I personally put it on the desktop)
insert image description here
and execute the command

ruby brew_install

Just wait for the offline installation to complete

Install gcc with brew

terminal command

brew install gcc

If there is a problem during the installation, please refer to my other article
on updating and installing HomeBrew on Mac. Error: Error: The following directories are not writable by your user

Guess you like

Origin blog.csdn.net/weixin_50679163/article/details/119302546