You can make a difference in the Apple Support Community!

When you sign up with your Apple Account, you can provide valuable feedback to other community members by upvoting helpful replies and User Tips.

Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

Environment variables

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.

Macbook (2015 or later)

Posted on Jan 4, 2019 9:04 AM

Reply
Question marked as Top-ranking reply

Posted on Jan 5, 2019 10:45 AM

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

4 replies

Jan 4, 2019 9:32 AM in response to John Galt

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.

Environment variables

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.