homebrew 的安装以及可能遇到的问题

1. install

官网只有一条命令:

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

==在国内可能会遇到这样的问题:==

curl: (7) Failed to connect to raw.githubusercontent.com port 443: Operation timed out

这是因为网络的问题, raw.githubusercontent.com访问不稳定

2. 解决办法

  1. 打开 shell ,然后输入下面一行命令,设置代理

    export https_proxy=http://127.0.0.1:7890 http_proxy=http://127.0.0.1:7890 all_proxy=socks5://127.0.0.1:7891

    这里的端口号需要看代理软件开启的端口号,比如clashX

    image-20220122213019485

  2. 设置git的代理

    git config --global https.proxy http://127.0.0.1:7890

    git config --global http.proxy http://127.0.0.1:7890

  3. 再执行官网的命令

  4. 在下载完成之后,可能会提示/opt/homebrew/bin is not in your path

    image-20220122213414757

  5. 此时,会提示看 next step,运行提示的命令就可以了,比如:

    image-20220122213638160