You can set an environment variable on a Mac that will be available in all apps (not just the command line) by using "launchctl" (see here):

launchctl setenv VARIABLE_NAME VALUE

Note that this will only take effect for apps started after you have set the environment variable.