Who sets the BROWSER environment variable in macOS?

Solution 1:

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.

Solution 2:

To answer myself, BROWSER, EDITOR, VISUAL and PAGER are all set by ~/.zprofile.

They seem to be added by the Prezto ZSH configuration framework.