I use the environment.plist
method to setup global variables in macOS.
I have this template in ~/Library/LaunchAgents
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>setenv.XDG</string>
<key>Program</key>
<string>/bin/zsh</string>
<key>ProgramArguments</key>
<array>
<string>/bin/zsh</string>
<string>-c</string>
<string>
launchctl setenv FOO BAR;
</string>
</array>
<key>RunAtLoad</key>
<true/>
</dict>
</plist>
It works.
But: when I restart my computer, I need to open Terminal.app
and close it at least once or the variables will not be available to GUI apps.
How shall I change that setup to skip opening Terminal.app after a reboot?
zsh
not useset
/setenv
command to set environment variables ? unix.stackexchange.com/questions/368944/…launchctl
to set global environment variables, the shell shouldn't matter.