Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

when adding env varialbes like:

export JAVA_HOME=/usr/java/skd/bin

where is this stored if I want to edit it later? is it a file somewhere?

share|improve this question
add comment

2 Answers

When you export an environment variable it is not stored in any non-volatile memory like hard disk or such. It is only remembered by shell, moreover, only in the shell you ran this command in, either by hand or with a script. So a reply to your first question may be "it is stored only in memory, local to running shell". Of course anything you will run from the shell will inherit it's environment.

If you want to change the value of environment variable, just run export again with the same variable name, like export JAVA_HOME=/usr/other_java/bin.

As the taspeotis noted, if you want the environment variable to be restored in each application launched without need of typing it manually, you can use the ~/.MacOSX/environment.plist file.

If you want it to be set only in Terminal windows, you can add the export command (as you would type it into shell) to the end of ~/.bashrc file (shell expands ~ to your home directory).

share|improve this answer
1  
Or: if the values are only needed in Terminal, then add the export to the file ~/.bash_profile (assuming one is using the default Bash in Terminal). –  Arjan Jun 6 '10 at 12:09
    
@Arjan +1, thanks, extended answer. –  whitequark Jun 6 '10 at 12:14
add comment

where is this stored if I want to edit it later?

What do you mean edit it later? Export it again. It shouldn't matter where it is stored, I imagine the implementation could be shell-specific, maybe the shell performs caching of variables. Maybe it doesn't. Either way, you can read and write the environment variables in the shell so I can't imagine why you need this file.

export KEY=VALUE1

...

export KEY=VALUE2

For the record the file is ~/.MacOSX/environment.plist, as per here.

share|improve this answer
add comment

Your Answer

 
discard

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.