How do i get IntelliJ to pick up my environment variables on MacOS X?

Kamilski81 picture Kamilski81 · Aug 1, 2012 · Viewed 9.9k times · Source

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: "

Answer

CrazyCoder picture CrazyCoder · Aug 1, 2012

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