Novice guide to install brew on mac

There are actually many tutorials on how to install brew on the Internet, but they vary greatly. Today I will share with you an installation tutorial for beginners.

1. Check whether brew is installed on your computer

Insert image description here

2. Installation through the official website command found that it does not work.

Brew official website: https://brew.sh/
Insert image description here
Directly execute the official website installation command:
Insert image description here
After running, it is found that the installation failed:
Insert image description here

3. Successfully install brew through the installation package.

1) Open the github page and download the corresponding mac system installation package

Download address: https://github.com/Homebrew/brew/releases/tag/4.1.4
Insert image description here
Download completed:Insert image description here

2) Perform the installation steps

Double-click to run the downloaded installation package, click Continue to agree to the installation agreement, and then continue or next step. The
Insert image description here
Insert image description here
Insert image description here
installation is complete, the following page is displayed, just close it.
Insert image description here

3) Configure environment variables

Execute the following 4 commands in the terminal in sequence:

echo 'export PATH="/opt/homebrew/bin:$PATH"' >> ~/.bash_profile 

source ~/.bash_profile

echo 'export PATH="/opt/homebrew/bin:$PATH"' >> ~/.zshrc   

source ~/.zshrc

Insert image description here

4) Installation completed

Execute the brew command and find relevant information, indicating that it has been successfully installed.
Insert image description here

4. Other installation methods (command installation)

Execute the following command and then mirror the selection input: 1

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

Insert image description here
Then enter your password and wait for the installation to complete.

5. Summary

There are generally two ways to install brew: installation package or command line.

Installing through the installation package requires configuring environment variables. Generally, it is more convenient to use the command line, but the command line may cause the installation to fail due to mirroring problems. Both methods have their own advantages and disadvantages.

Guess you like

Origin blog.csdn.net/ganyingxie123456/article/details/132182152