Textmate is launched via launchd, not from the shell.
Your $PATH will travel over if you run something directly from the shell (open -a Textmate does not work, open will not pass your environment to Textmate).
The ways to get around this are environment.plist, launchctl, or launchd.conf:
Setting environment variables in OS X?
update
If you edit /etc/launchd.conf
and reboot, the changes will take effect. Each line can be a launchctl command like setenv VAR_NAME "VAR_VALUE"
. You could then run this file with launchctl your_file
.
It's a pain having to reboot though. And if you want per-user environment settings, this is no good. Apple proposes ~/.launchd.conf
could be used for user-specific settings, but has yet to implement this feature.
You could set a script to run on login with a LoginHook and LogoffHook (see Apple's documentation). Or, using LaunchAgents. For detailed directions on how to set up a LaunchAgent, look at nicksay's post on this Macworld post.
The launchctl setenv
command doesn't seem to work while logged in. I'm currently banging my head against this.
I ran into basically the same problem you're having today (the Makefile bundle would not pass LIBRARY_PATH to gcc), and now I'm writing a python script that will read a file of variable assignments on login, store a copy of the current environment and that file with the assignments, and then unload all the variables on logout. That also reminds me, I should have an update option. I'll post a comment with the link to a github repo for it here when I'm done. If it works, that is.