Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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

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

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
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

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

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.