Gradle builds not getting environment variables


This is an old and recurring theme with IDEA, but why aren't environment variables that are defined on a local system passed from IDEA to Gradle when running a Gradle task?

Since IDEA is a great tool, I really hope there's something obvious I'm missing.

Am using IDEA 2017.1.4 on macOS Sierra.


Comment actions Permalink

It would depend on where you've specified the variables, since Mac has different places for that and not all of them will affect GUI apps, see

As you can notice from the different answers, every new macOS version changes the way to specify environment variables to make it even more confusing.

Comment actions Permalink

Thanks for the link. It's true that there are a confusing variety of ways on a Mac that environment variables might get set.

I'll experiment with setting the env vars in different ways (i.e. /etc/launchd.conf) and see if I can get them to be seen by Gradle when launched from IDEA.


Please sign in to leave a comment.