The situation:
I need to set some environment variable to be accessed within a programm. It works if I open a Terminal window (zsh shell), set the variable via export VARNAME=VARVALUE
and then launch the programm from that terminal window (for example by open ~/Applications/myApp.app
.
The problem
Now I want the environment variable to always be set when I run the application by just double-clicking it in the Applications folder. Therefor I created the file ~/.zshenv
and wrote the export statement in there.
Now when I open some Terminal window, the desired environment variable is already set (can be shown by using env
command) and when I launch the application from terminal everything is fine. But as soon as I launch the application by just clicking the .app file the variable isn't set in the programm context.
I can't find any information online as to which shell/process launches applications if you just click them this way. Does anyone have an idea on how to fix the issue?