On 3 Oct 2009, at 20:53, snowmaninthesun wrote:
Yep, thats exactly the case!! How can i set textmate to auto use my path variable instead, when i tried just deleting that variable, my tests no longer run.
Well… a process has a bunch of variables, these are inherited by each child process spawned.
PATH is one of these variables, and the “root” process will give it some sane value like: /bin:/sbin:/usr/bin:/usr/sbin — so all processes will inherit that, but each process is of course free to overwrite it.
You can overwrite it for the first process spawned when you login to your account via the ~/.MacOSX/environment.plist file. These values will thus be used by all successive processes spawned.
One process where PATH is used is the shell (bash) which normally is launched by Terminal, so by default bash would use the value you set in environment.plist but you can overwrite it in /etc/profile or any of the dozen other startup files that the shell execute.
Another process where PATH is used is TextMate, which again inherits from environment.plist but allows you to overwrite values via Preferences → Advanced. From TextMate you can run commands via a shell interpreter, so here PATH can again be overwritten by /etc/ profile and similar, but far from all commands go via a shell interpreter.
In light of that, the question of “how to auto-set PATH” makes less sense. I think what you maybe wanted to ask “how to only set PATH once?”. In that case, the most appropriate would be environment.plist, but you have to make sure that no shell startup file overwrites the variable (the default /etc/profile used to do that, but I don’t think it does anymore). The tedious thing about environment.plist though is that for the changes to be effective, the root process needs to be relaunched (that is, you need to logout of your account and login again).