1

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?

2
  • Which shell are you using?
    – nohillside
    Commented Feb 4, 2020 at 13:59
  • @nohillside both bash and zsh have the same environment variable set
    – Fez Vrasta
    Commented Feb 4, 2020 at 14:14

2 Answers 2

3

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.

8
  • And: LaunchDaemons/LaunchAgents! ;-) or a combination of plist and LaunchAgent (e.g. Hannes Schmidt's Environment Variables)
    – klanomath
    Commented Feb 4, 2020 at 15:28
  • @klanomath How can Launch{Agent,Daemon}s influence the environment variables you see in a shell?
    – nohillside
    Commented Feb 4, 2020 at 15:38
  • /bin/launchctl setenv FOO BAR properly packed in a Launch{Agent|Daemon} (and loaded, of course)
    – klanomath
    Commented Feb 4, 2020 at 15:47
  • 3
    Recently (27 mins ago) tested in a 10.15.3 VM ;-)
    – klanomath
    Commented Feb 4, 2020 at 16:13
  • 1
    @klanomath You rock!
    – nohillside
    Commented Feb 4, 2020 at 16:30
3

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

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

You must log in to answer this question.

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