I am using Qt Creator with a custom build system (ninja). The problem is that the $ PATH variable passed to the IDE Qt Creator, absolutely vanilla: /usr/bin:/bin:/usr/sbin:/sbin.
So I need to write bash -c '/path/to/ninja list of targets'instead of just ninja list of targetsor follow the build steps in the terminal, and not in the IDE.
I tried all known recipes to set up $ PATH.
- ~ / .bash_profile and ~ / .profile
- / etc / paths
- /etc/paths.d/*
- /etc/launchd.conf (
setenv PATH .....) - ~ / Library / LaunchAgents / *. plist (
sh -c 'launchtcl setenv PATH $PATH:.....') - / Library / LaunchAgents / *. Plist
The idea of using launch agents is described in https://stackoverflow.com/a/16829/16 .
Nothing works! Any arbitrary var variable in my custom .plist file is set correctly - any other than PATH. (I tested it simply: created a custom build step echo xzxzxz=$XZXZXZ path=$PATH, where xzxzxz is also installed in my launch agent).
Interestingly, if I run Qt Creator from a bash ( '/Applications/Qt Creator.app/Contents/MacOS/Qt Creator' &) session , it will get the correct PATH, just like bash itself.
It is also interesting that the PATH assigned with the launch agent is overwritten later. I wrote there sh -c 'launchctl setenv PATH $PATH:/HELLOWORLD', but I do not see this HELLOWORLD's echo $PATH. So, there is a race condition, someone rebuilds PATH from / etc / paths and / etc / paths.d later.
In this way:
- Is there an exhaustive and relevant explanation of how to set up environment variables, and in particular PATH, on OSX 10.10?
- why does PATH become vanilla?
- How to win with Qt Creator?