Depending on your shell, and config, Open ~/.bashrc, ~/.bash_profile, or ~/.zshrc or wherever you set your shell variables, and set:

    1. export HTTP_PROXY="http://localhost:8888"
    2. export http_proxy="http://localhost:8888"
    3. export ALL_PROXY="http://localhost:8888"
    4. export all_proxy="http://localhost:8888"
    5. export HTTPS_PROXY="http://localhost:8888"
    6. export https_proxy="http://localhost:8888"

    参考资料: