Homebrew and apt ignore your proxy? Terminal variables, sudo and safe rollback

Your browser downloads fine, yet `brew install` or `sudo apt update` times out. Browsers read desktop proxy settings; package managers do no

Your browser downloads fine, yet brew install or sudo apt update times out. Browsers read desktop proxy settings; package managers do not. Fix it per tool and test once before making anything permanent:

  1. Homebrew uses curl and git under the hood, so it follows environment variables. Test with a one-off: HTTPS_PROXY=http://127.0.0.1:<port> brew update. If that works, add the export to your shell profile.
  2. APT runs as root, and sudo drops most of your environment. sudo apt update will not see the variable you exported. Test with sudo apt -o Acquire::https::Proxy="http://127.0.0.1:<port>" update.
  3. To make APT permanent, create a small file like /etc/apt/apt.conf.d/95proxy with an Acquire::http::Proxy line. Keeping it in its own file makes rollback a single rm.
  4. Do not disable signature checks or swap your official sources to fix a timeout. Those are separate problems.
  5. Set NO_PROXY for local and internal hosts so mirrors on your LAN are not routed away.

Full guide with rollback steps: https://roxi.cc/pkgnet26.html

Written by the small team behind Roxi.


Write a comment