M1 chip installation Homebrew [nanny-level graphic tutorial]

Homebrew installation

  Downloading git on MacOS requires Homebrew for installation. After installing homebrew according to other installation tutorials before, I couldn’t use the brew command in the terminal. When I entered brew, the computer would prompt that the command could not be found, and then I couldn’t find it in the computer. Now it finally works.

installation steps

(1) Open the terminal and enter the following command.

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

(2) Choose a download source, whichever is fine.

image-20221006235502788

(3) Then enter Y to start the installation.

image-20221006235413180

(4) After installing locally, you also need to select the mirror image configured by brew install.

image-20221006235757643

(5) After the installation is successful, the following interface will appear, copy the string of instructions I framed.

image-20221006235930541

(6) Run the string of instructions in the previous step to activate the environment variables.

image-20221007000208548

(7) Enter the following command to verify whether the installation is successful. If the version number appears, the installation is successful.

brew -v

image-20221007000307522

Problems encountered during brew install

1. report errorfatal: not in a git directory Error: Command failed with exit 128: git

Solution:

(1) Enter the following command, the following content will appear.

brew -v

image-20221007001458551

(2) The content prompts that homebrew-cask and homebrew-core need to be configured, just enter the following command in the terminal.

git config --global --add safe.directory /opt/homebrew/Library/Taps/homebrew/homebrew-core
git config --global --add safe.directory /opt/homebrew/Library/Taps/homebrew/homebrew-cask

2. hintDisable this behaviour by setting HOMEBREW_NO_INSTALL_CLEANUP. Hide these hints with HOMEBREW

Solution:

Enter the following commands as prompted.

export HOMEBREW_NO_INSTALL_CLEANUP=TRUE

Guess you like

Origin blog.csdn.net/weixin_44786971/article/details/127189872