Hmm... As of Mac OS X 10.10.5 and probably earlier,
man -s5 launchd.conf tells us: "
launchd.conf is no longer respected by the system." I have too much stuff going on right now to put a dummy variable in the file and restart to see if it really does work or not after all, but the documentation says it should not work.
I'm pretty sure it won't. Do
man launchctl and you'll see: "
The /etc/launchd.conf file is no longer consulted for subcommands to run during early boot time; this functionality was removed for security considerations."
What you can do is put all the environment variables you want to be global-ish into some file, perhaps called
environment in keeping with Linux, or (in case Apple decides to do something with that later – you never know)
environment.conf, like I did, then source this via
if [ -f /etc/environment.conf ]; then
or, if you prefer the compact format:
if [ -f /etc/environment.conf ]; then . /etc/environment.conf; fi
If you use some other shell than bash, and it uses the same variable-setting syntax as bash (as does zsh, I think), you'll need to also source this file from that shell's system-wide rc file (e.g.
/etc/zshrc). If you use a shell that uses a different syntax, e.g. tcsh, you'll need to either maintain a similar file for that shell and source it from the shell's system-wide rc file (e.g.
/etc/csh.cshrc for tcsh), or better yet create a script that auto-generates it, so you only have to edit one file to add/change variables. This isn't the place for such a tutorial; a few seconds on Google turned up how to convert [t]csh variable exports to bash syntax, at https://stackoverflow.com/questions/2710790/how-to-source-a-csh-script-in-bash-to-set-the-enviroment, so there's probably something available to go the other direction.
It's been my experience that Mac OS X is moving further and further away from predictable rc file behavior. As of at least 10.8, it no longer seems to load
/etc/rc.<anything>, nor (since at least 10.9) will it load
/etc/bash.bashrc for interactive nonlogin shells (which it certainly should be doing, just like it loads
~/.bashrc for them, still, as of 10.10). Then again I have Fink, MacPorts, and Homebrew all installing stuff, so maybe one of them is interfering with default dotfile behavior. YMMV.