According to https://brew.sh, installing homebrew only require one line of terminal command:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
Yet, connection error may occur in some countries or regions.
~% /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
curl: (35) LibreSSL SSL_connect: SSL_ERROR_SYSCALL in connection to raw.githubusercontent.com:443
curl could easily using HTTP proxy by appending '-x host:port' for a better Internet connection.
/bin/bash -c "$(curl -fsSL -x 127.0.0.1:PORT https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
or '-socks4 host:port' or 'socks5 host:port'.