Run commands without proxy environment variables.
Proxy settings (http_proxy, https_proxy, all_proxy, etc.) sometimes interfere with tools that connect to local services, internal mirrors, or GitHub.
unpxy temporarily unsets these variables for a single command, leaving your shell environment unchanged.
If you run unset http_proxy directly in your shell, the proxy is removed for the rest of the session.
unpxy confines the effect to a single command, so you don’t have to remember to re‑export your proxy variables afterwards.
Clone the repository and source the script in your .bashrc / .zshrc:
git clone https://github.com/0xA672/unpxy.git
echo "source $PWD/unpxy/unpxy.sh" >> ~/.zshrc # or ~/.bashrcOr simply copy the function into your shell config manually.
Fish users should use unpxy.fish:
# Add to ~/.config/fish/config.fish
source /path/to/unpxy.fishunpxy [-p] [-h] [--] <command>
| Option | Description |
|---|---|
-p |
Evaluate the remaining arguments as a shell expression. Use this when you need pipelines, redirects, or shell builtins. |
-h, --help |
Show a help message and exit successfully. |
-- |
Explicitly mark the end of options; everything after is treated as the command (useful if the command starts with a dash). |
unpxy curl -fsSL https://example.com/script.shThe command runs immediately in a proxy‑free subshell.
When you need an entire pipeline to ignore the proxy, use the -p flag and quote the full pipeline as a single string:
unpxy -p "curl -fsSL https://example.com/script.sh | bash"This ensures both the download and the execution of the script happen inside the same clean environment.
Fish users can pass the pipeline in the same way, or split arguments naturally (fish’s eval joins them):
unpxy -p curl -fsSL https://example.com/script.sh "|" bash
# or as a single string
unpxy -p "curl -fsSL https://example.com/script.sh | bash"Calling unpxy without arguments prints a usage message and returns exit code 1:
unpxy
# Usage: unpxy [-p] [--] <command>Passing an unknown option also results in an error:
unpxy -x echo hello
# unpxy: unknown option: -x-
Single command mode (no
-p):
Creates a subshell with(...), unsets common proxy variables inside that subshell, and then replaces the subshell with your command viaexec "$@".
The parent shell’s proxy settings remain untouched. -
Pipeline mode (
-p):
Also opens a subshell, unsets all proxy variables there, and then passes the quoted pipeline string toeval.
This allows complex shell syntax (pipes, redirects, command lists) to run entirely inside the proxy‑free environment.
After the command finishes, the subshell exits and your original shell environment is exactly as before.
MIT — see LICENSE file.