# Setting environment variables (PATH, etc) outside shell



## Viro (Feb 4, 2005)

How do I set environment variables outside so that they are visible outside the shell? I know the usual way of setting such variables is in the .profile or .bashrc file in one's home directory. The problem with this is that the variables that are set are only visible within the terminal. I want these variables to be visible system wide.

How do I go about doing that? Adding stuff to /etc/profile doesnt seem to work.


----------



## Darkshadow (Feb 4, 2005)

There's a file you can create/edit to have variables available to everything running (including Cocoa apps).  In your user's home folder, create a folder named .MacOSX.  Inside this folder, create a file named environment.plist.  This is a standard plist file.  You would add the environment name as the key, and the value as a string.

Here's an example (have this set for one of my users):


```
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
        <key>CVS_RSH</key>
        <string>/usr/bin/ssh</string>
        <key>GL_ENABLE_DEBUG_ATTACH</key>
        <string>NO</string>
</dict>
</plist>
```

Note that you'd have to set this up for every user - as far as I know, there's not a system wide file.


----------



## wadesworld (Feb 5, 2005)

What's the GL_ENABLE_DEBUG_ATTACH used for?  I haven't seen that one before.  Is that X11 related?

Wade


----------



## Viro (Feb 5, 2005)

Could that be to enable you to attach the debugger to a process that uses OpenGL?


----------



## Darkshadow (Feb 5, 2005)

Yeah, something like that.  I had it set to on, then instead of deleting it, I just set it to NO.

Did creating this file work the way you wanted it to?


----------



## Viro (Feb 8, 2005)

Yes. It did. Cheers.


----------

