Has anyone else noticed the following with Android Studio 1.4 running on OS X El Capitan?

I can't remember the exact point when I lost the ability to build an Android app from the IDE due to the fact that the extensive set of custom pre build steps that I have failed to run. Those custom steps run a Python-script, and the main problem is that gradle doesn't seem to find the Python-binary due to the fact that the PATH environment variable is the extremely sparse list of /usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin.

Here are some random points related to finding this issue:

  • This problem does not affect building from the terminal.
  • This problem is specific to OS X, none of my Linux boxes suffer from this, nor my colleague's Windows machine suffer from this.
  • This is specifically about having PATH set properly.

What I've tried this far:

  • Editing /etc/paths: nope, no help.
  • Various ~/Library/LaunchAgent -tips found from the net. Y'know those launchctl setenv PATH ...? No help.
  • Please don't add a possible answer in your question. Instead answer your question by adding one using Your answer - you are expressly encouraged to do so.
    – klanomath
    Oct 26, 2015 at 9:11

1 Answer 1


After further work on this, I found something that seems to work. I RTM'ed the man page of launchctl, and noticed the config-subcommand. So this is what I did:

sudo launchctl config user path "paths:I:want:GUI:apps:to:use"

Then reboot, as launchctl instructed me to do.

I had added a debug print statement to my gradle file:

println System.getenv("PATH")

After rebooting, build printed out the changed PATH including those parts that I added via config user path.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .