13

I have tried to set these using RCenvironment, .bashrc, .MacOSX/environment.plist and /etc/launchd.conf and restarted computer....IntelliJ is still not picking up my env variables:

Gemfile p "ENVIRONMENT: #{ENV['VAR_PRIVATE_GEM_USERNAME']}" # Outputs "ENVIRONMENT: "

2 Answers 2

14

See the related questions:

Your question is not specific to IntelliJ IDEA at all.

On Mountain Lion solutions from the first link will not work, so you can do something like this in the Terminal:

export VAR_PRIVATE_GEM_USERNAME=John
open -a /Applications/IntelliJ\ IDEA\ 11.app/

Also note that many Run/Debug configurations in IntelliJ IDEA allow to set custom environment variables:

enter image description here

0
7

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 https://ss64.com/osx/launchctl.html)

launchctl setenv VARIABLE_NAME VALUE
1
  • 1
    That would require you to turn off the System Integrity Protection which is also not ok
    – Hmbucker
    Jun 22 at 12:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.