先通过https://brew.idayer.com/guide/start/中的指导进行安装。
安装过程中会提示需要安装 command line tools,如果不想安装xcode,可以到https://developer.apple.com/download/more/下下载和系统匹配的command line tools进行安装,可能需要先登录,然后到https://developer.apple.com/download/more/这个网址下查找相应的版本进行安装。
安装过程中如果报错,如“Failed to install Homebrew Portable Ruby (and your system version is too old)!”这样的错误,可以尝试使用该https://brew.idayer.com/guide/change-source/页面提到的切换镜像源的方法试试。