0

I have a 2019 mac running MacOS 10.14.6. I've had it configured to use my company's corporate proxy for about a month and various command line programs such as curl, brew, and git behave as expected until very recently.

From day one, I've had /etc/profile configured as follows:

$ cat /etc/profile 
# System-wide .profile for sh(1)

if [ -x /usr/libexec/path_helper ]; then
        eval `/usr/libexec/path_helper -s`
fi

if [ "${BASH-no}" != "no" ]; then
        [ -r /etc/bashrc ] && . /etc/bashrc
fi

http_proxy=http://proxy.whatever.com:80/
https_proxy=http://proxy.whatever.com:80/
ftp_proxy=http://proxy.whatever.com:80/
no_proxy="localhost,127.0.0.1,192.168.64.2"
all_proxy=192.168.1.1:80
HTTP_PROXY=http://proxy.whatever.com:80/
HTTPS_PROXY=http://proxy.whatever.com:80/
FTP_PROXY=http://proxy.whatever.com:80/
NO_PROXY="localhost,127.0.0.1,192.168.64.2"
ALL_PROXY=192.168.1.1:80

For some reason, all of the programs listed above now ignore the proxy setting despite an echo of the various proxy environment variables behaving as you'd expect in both Terminal and iTerm2:

# Output from Terminal
$ curl https://www.google.com/
curl: (7) Failed to connect to www.google.com port 443: Operation timed out

$ echo $http_proxy
http://proxy.whatever.com:80/
$ echo $https_proxy
http://proxy.whatever.com:80/

# Output from iTerm2

$ echo $http_proxy
http://proxy.whatever.com:80/
$ curl https://www.google.com/
curl: (7) Failed to connect to www.google.com port 443: Operation timed out
$ echo $https_proxy
http://proxy.whatever.com:80/

Interestingly, printenv doesn't see the proxy environment variables while echo does and the old set method does too:

$ (set -o posix ; set) | grep proxy
FTP_PROXY=http://proxy.whatever.com:80/
HTTPS_PROXY=http://proxy.whatever.com:80/
HTTP_PROXY=http://proxy.whatever.com:80/
ftp_proxy=http://proxy.whatever.com:80/
http_proxy=http://proxy.whatever.com:80/
https_proxy=http://proxy.whatever.com:80/
no_proxy=localhost,127.0.0.1,192.168.64.2

I've tried to apply logic and reason, but I have no mental model for what might be going wrong here.

1 Answer 1

1

Interestingly, printenv doesn't see the proxy environment variables while echo does and the old set method does too

  • echo $http_proxy tells you the shell itself expanded $http_proxy successfully.
  • set is a shell builtin that has access to shell variables.

But

  • printenv prints its own environment.

What makes variables "environment variables"? I see no export in your profile. It looks like the variables are not exported. Export them to the environment:

export http_proxy=http://proxy.whatever.com:80/
# etc.
0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .