4

I was using the method described in this post to invoke "launchctl setenv" to set environment variables globally. I have just upgraded to OS X 10.11 "El Capitan," and now I see that the launchctl command works fine, but appears to have no effect on the actual environment. For example, here is the output from some debug code I stuck into a "make" file running under Eclipse:

launchctl getenv PATH /usr/bin:/bin:/usr/sbin:/sbin:/opt/ecos/gnutools/h8300-elf/bin:/opt/ecos/gnutool s/arm-elf/bin:/usr/local/bin:/opt/local/bin:/opt/local/sbin

echo "PATH = /usr/bin:/bin:/usr/sbin:/sbin"
PATH = /usr/bin:/bin:/usr/sbin:/sbin

Anyone have any idea what's happening to me? Thanks in advance.

  • 2
    That echo command does not show PATH just the text in "" try echo $PATH and do you mean setenv rather than getenv – user151019 Nov 16 '15 at 13:29
  • Actually, I did a "launchctl getenv PATH" and "echo $(PATH)" within my makefile, and then copied/pasted the output, not noticing that make had already done the substitution and that the line-feeds between command and output got lost. Sorry. – Philip Keller Nov 17 '15 at 14:01
  • In the meantime, I also verified that the problem does not come from "make" : I replaced Eclipse's build command, which was a "make", with "printenv PATH", and the result is the same. Nor does it come from Eclipse: I wrote a quick command-line program in Xcode to do a getenv("PATH"), and ran it within the debugger. It showed that the path was modified by Xcode, but it didn't include my modifications that I had applied via launchctl. I'm really beginning to think that "launchctl setenv" is accepted but ignored in El Capitan. – Philip Keller Nov 17 '15 at 14:01
  • The pointy of my comment is hat you are not showing us the actual path e.g. output from echo $PATH – user151019 Nov 17 '15 at 14:28
  • 1
    The command was: echo "PATH = $(PATH)" and the output was: PATH = /usr/bin:/bin:/usr/sbin:/sbin – Philip Keller Nov 17 '15 at 18:02