Benches macOS

4

Environment variables

apple Verified

Imported from the Apple Support Forums via the Wayback Machine 🔗

I need to set the environment variable for use in a web application. I don´t know how to create for use in Mojave OS. Can anyone give me some directions for setting that environment variable.

Thanks.

4 replies

Sign in or join Beachball Help to reply.

  1. 0

    John Galt

    Imported from the Apple Support Forums via the Wayback Machine 🔗

    It seems to me the right way to accomplish that would be to create a launch daemon to set that environment variable at boot or login.

    Start here: http://developer.apple.com/documentation/MacOSX/Conceptual/BPSystemStartup/index.html or man launchd

  2. 0

    John Galt

    Imported from the Apple Support Forums via the Wayback Machine 🔗

    Can anyone give me some directions for setting that environment variable.

    Not without additional information.

    An environment variable is a very generic term and an answer will require very specific information.

    Writing an effective Apple Support Commun… - Apple Community

  3. 0

    david_jhm

    Imported from the Apple Support Forums via the Wayback Machine 🔗

    Hello Jhon,

    I am developing a web application and I need to read data from an environment variable. I wrote export VARIABLE = /path/file.properties in the file /etc/profile but the application does not find that variable when executing.

    When I execute in the terminal app then next command launchctl setenv VARIABLE $ VARIABLE finds it, but every time I restart my MAC, I have to enter at terminal app and run launchctl .....

    How to permanently set environmet variable?

    Thank you.

  4. 0

    david_jhm

    Imported from the Apple Support Forums via the Wayback Machine 🔗

    Thanks very much, John, for this helpful solution.