Who sets the BROWSER environment variable in macOS? I noticed I have BROWSER set to open in my environment variables, but I can't figure out where it gets set by the system.

When I run env I get this output:

USER=xxx
PATH=xxx
LOGNAME=xxx
SSH_AUTH_SOCK=xxx
HOME=xxx
SHELL=xxx
__CF_USER_TEXT_ENCODING=xxxx
TMPDIR=xxx
XPC_SERVICE_NAME=xxx
XPC_FLAGS=xxx
BROWSER=open
EDITOR=nano
[...]


It doesn't seem like something on my user configuration, is it standard to have BROWSER=open in macOS (10.15.3)? Where can I find the configuration file that sets it?
BROWSER is not set by default on macOS. Where exactly it is set depends on the shell you are using and its specific configuration:


bash: /etc/profile, ~/.bash_profile, ~/.bashrc
zsh: /etc/zshenv, /etc/zprofile, /etc/zshrc, /etc/zlogin, ~/.zshenv, ~/.zprofile, ~/.zshrc, ~/.zlogin


Besides the configuration files itself the variable may also get set in a script sourced from one of them.