Steps:
1. Open your terminal, copy the following command and click enter.
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
2. It takes a few minutes to install and you should see 'Installation Successful' message on your terminal if everything goes right. That means installation is done, but in order to use HomeBrew, you need to make some changes to PATH.
3. You might see an error like this if you type brew on your terminal: zsh: command not found: brew
4. To solve that, create .zshrc on home directory (If it was not created yet). Just run on terminal:
touch ~/.zshrc
5. Now open your Finder, on the menu bar, click on Go and click on Home. Now click shift+cmd+. . This will show hidden files in the folder. Locate .zshrc and open with Text Editor.
6. Now add this command to the file on a new line and save the file.
export PATH=/opt/homebrew/bin:$PATH
7. After saving the file, run the following command in the terminal:
source ~/.zshrc
8. Now you should be able to use brew. To make sure it works, run this command:
brew doctor
It should output: Your system is ready to brew.