Ask Different is a question and answer site for power users of Apple hardware and software. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I use Qt Creator as my main IDE for cross-platform C++ application development. In doing so I had set it up so that it depends on a set of environment variables that I define in .bashrc.

On Linux (Ubuntu specifically) that works fine but on OSX Lion I cannot get it to work. I have defined my variables in .bashrc and .bashrc is sourced inside .bash_profile. The variables are defined when I do echo $VAR inside the terminal but when I open the IDE (from Dock) it does not recognize the variables. Does Dock not use bash to launch applications?

share|improve this question
up vote 1 down vote accepted

Apps launched from the dock or desktop or any GUI do not use bash. They are all children of the workspace (the loginwindow process).

To set the environment variables you need to edit ~/.MacOSX/environment.plist which is read when you login. This is a text plist and you need to set a key element to the name of the environment variable it uses and the next string element to its value. See Apple's documentation for Setting environment variables for user processes

e.g. mine is for WAFDIR and PATH

<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "">
<plist version="1.0">

share|improve this answer
Thanks. I just learnt I could also modify /etc/launchd.conf or use launchctl inside my .bashrc file. Any difference between those methods and using the one you mentioned? – GradGuy Jun 26 '12 at 8:19
Where did you learn from so we can see the context. Yes /etc is global and could get overwirren by Apple, and launchctl in your .bashrc I think launces the app from terminal but you need to go to terminal to do that so might as well use open or the full path the the executable in the app. Also this is the Apple supported way – Mark Jun 26 '12 at 8:21
here: This seems to work for now when I open applications from the dock but I might switch – GradGuy Jun 26 '12 at 8:24

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.