Homebrew — The Missing Package Manager for macOS (or Linux)
This is main page of brew, which is powerful software. you can go into it to see the details and there exists the tutorial of installation.
when i was installing homebrew over, it returned me a "next step",which was like this:
so, the solution is mentioned by this as well. Just run these two commands in termial, however, you should notice the command line. So, following the next picture, you will install the brew successfully.