mac m1 install git

1. Install brew

Homebrew is a package manager on Mac that helps you easily install and manage various open source software. To install Homebrew, open a terminal and run the following command:

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

insert image description here
Generally choose the first one

2. Verification

brew --version

If nothing else, it will report an error command not found: brew

3. Solve not found: brew configuration environment variables

sudo vim ~/.bash_profile

#添加
export PATH=$PATH:/opt/homebrew/bin;

#更新配置
source ~/.bash_profile

Verification: After the update is complete, enter brew --version verification, if the version number of brew is output, it has succeeded

4. Hide problems

Reason: The environment variable is configured in bash, but the current system uses the shell to
view the currently used shell

# 终端输入
echo $SHELL
# 如果输出是/bin/zsh,说明使用的是zsh

Solution: Use cd ~ to enter the main directory, enter ls -a to display hidden files
to check whether there is a .zshrc file, if not, execute touch .zshrc to create one

# 编辑 .zshrc
vi .zshrc

Press i to enter edit mode, paste source ~/.bash_profile, click Esc, and then enter wq to save and exit

source ~/.bash_profile

Finally test it, the problem is solved

Guess you like

Origin blog.csdn.net/qq_37924396/article/details/130794099
Recommended